Java实列 酒店订房管理系统
======思路======
查看 ======实现====== ======代码====== import java.util.Scanner; public class Reception { public static void main(String[] args) { //首先来一条友善的系统名称 System.out.println("********************东方国际大酒店管理系统*************************"+"tn"); Hotel hotel=new Hotel();//新建酒店类,以便调用酒店类的方法 Scanner in=new Scanner(System.in);//系统接受前台人员输入指令 while(true) { System.out.println("订房输入 1; 退房输入 2:"); int input=in.nextInt();//保存前台人员输入指令 if (input==1) {//判断是否是“订房” System.out.println("********************客房信息*************************"+"tn"); hotel.checkRoomInfo();//显示客房最新信息 System.out.println("tn"+"*****************************************************"+"tn"); System.out.println("入住的客房号:"); int cin=in.nextInt();//保存前台人员输入指令 hotel.checkIn(cin);//把指令传给酒店类的订房方法去处理 } else if (input==2) {//判断是否是“退房” System.out.println("********************客房信息*************************"+"tn"); hotel.checkRoomInfo();//显示客房最新信息 System.out.println("tn"+"*****************************************************"+"tn"); System.out.println("退房的客房号:"); int con=in.nextInt();//保存前台人员输入指令 hotel.checkOut(con);//把指令传给酒店类的退房方法去处理 }else System.out.println("********************客房信息*************************"+"tn"); hotel.checkRoomInfo();//显示客房最新信息 System.out.println("tn"+"*****************************************************"+"tn"); } } } public class Room { //房间属性的get,set方法 public int getRoomNun() { return roomNum; } public void setRoomNun(int roomNun) { this.roomNum = roomNun; } public String getRoomType() { return roomType; } public void setRoomType(String roomType) { this.roomType = roomType; } public boolean isRoomStatus() { return roomStatus; } public void setRoomStatus(boolean roomStatus) { this.roomStatus = roomStatus; } //构造方法 public Room(int roomNun,String roomType,boolean roomStatus) { super(); this.roomNum = roomNun; this.roomType = roomType; this.roomStatus = roomStatus; } //重写toString方法 @Override public String toString() { return "【" + roomNum + ":" + roomType + ":" + (roomStatus?"客满":"空房" )+ "】 "; } } public class Hotel { 博主个人网站:www.davis-wiki.com (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |