package 课后作业; import java.util.Scanner; public class 新龙门客栈系统 { public static void main(String[] args) { System.out.print("n"); System.out.print("新龙门客栈系统n"); System.out.print("1.大床房 188元/间n"); System.out.print("2.标间 288元/间n"); System.out.print("3.三人房 388元/间n"); System.out.print("4.总统套房 488元/间n"); System.out.print("5.系统退出n"); System.out.print("n"); Scanner scanner=new Scanner(System.in); System.out.print("请输入所选类型的房间序号:"); int Serialnumber = scanner.nextInt(); while(Serialnumber<1||Serialnumber>5) { System.out.println("您输入有误请重新输入!"); Serialnumber = scanner.nextInt(); } double price=0; switch (Serialnumber) { case 1: price=188; break; case 2: price=288; break; case 3: price=388; break; case 4: price=488; break; case 5: scanner.close(); } System.out.print("请输入房间数量:"); int number = scanner.nextInt(); double money = price * number; System.out.println("实收金额:"+money); System.out.println("请付款:"); double amount = scanner.nextDouble(); if (amount < money) { System.out.println("没钱不要睡霸王觉"); } else { double give = amount - money; System.out.println("房间序号:" + Serialnumber + "数量" + number + "应收金额" + money + "实收金额" + amount + "找零" + give); scanner.close(); } } }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)