我很困惑我是否遵循了这一权利,并且在寻求安慰和一些帮助。所以我的主要问题是我是否遵循我的导师问题:当他说使用哨兵值循环构建它时?
其次,如何将总计四舍五入到两位小数?
如果它有助于我的任务是这样的:
说明:使用哨兵值循环。
询问每个用户:
车辆类型(可以使用字符串以外的其他东西,例如:1 表示经济型,2 表示轿车等) 租用天数 计算(对于每个客户):
租金、税费、应付总额。有三种不同的租赁选择,价格不同:经济型 @ 31.76、轿车 @ 40.32、SUV @ 47.56。[注意:仅考虑全天单位(无小时费率)]。
销售税 = TOTAL 的 6%。
创建汇总数据:
客户数量 收集到的总金额。此外,包括 IPO、算法和桌面检查值(设计文档)。
{我的设计和进度}
包易派;
导入 java.util.*; 导入 java.lang.Math;
公共课嗯{
int count = 0;
static int days;
static double DailyFee, NontaxTotal, CarType, Total;
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
System.out.print("What vehical would you like to rent?\n");
System.out.println("Enter 1 for an economy car\n");
System.out.println("Enter 2 for a sedan car\n");
System.out.println("Enter 3 for an SUV");
CarType = keyboard.nextInt();
if (CarType == 1)
DailyFee=31.76;
else if(CarType == 2)
DailyFee=40.32;
else if(CarType == 3)
DailyFee=43.50;
System.out.print("Please enter the number of days rented. (Example; 3) : ");
days = keyboard.nextInt();
NontaxTotal = (DailyFee * days);
Total = (NontaxTotal * 1.06);
System.out.printf("The total amount due is $" + Total);
}
}
一只萌萌小番薯
守着星空守着你
随时随地看视频慕课网APP
相关分类