综合练习7:话费充值向手机中充值10元。通话0.2元/分钟,通话时长已有30分钟;流量已使用10MB,流量费用为0.3元MB。计算话费余额还可以通话的时长。
public class question_7 {
public static void main(String[] args) {
// TODO Auto-generated method stub
double money = 10;
double call_cost = 0.2 * 30;
double flow_cost = 10 * 0.3;
double remain_money = money - call_cost - flow_cost;
double remain_call_time = remain_money / 0.2;
System.out.println("剩余通话时长" + remain_call_time + "分钟");
}
}