/*输入通话时长(秒),计算通话费用。费用按分钟计费,不足一分的
按一分钟计算,资费标准0.2元/分钟。*/
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("请输入通话时间秒");
int S = scan.nextInt();
if(S<60)
{
System.out.println("价格为0.2") ;
}
else if (S%60==0){
double a = S/60*0.2;
System.out.println("价格为"+a);
}
else {
double b = S/60*0.2+0.2;
System.out.println("价格为"+b);
}
}
运行结果:
