Java客栈系统小练习

家电修理 2023-07-16 19:17www.caominkang.com电器维修

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=ne Scanner(System.in);
  System.out.print("请输入所选类型的房间序号");
  int Serialnumber = scanner.nextInt();
  hile(Serialnumber<1||Serialnumber>5)
  {
   System.out.println("您输入有误请重新输入!");
   Serialnumber = scanner.nextInt();
  }
  double price=0;
  sitch (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();
  }
 }
}

Copyright © 2016-2025 www.caominkang.com 曹敏电脑维修网 版权所有 Power by