为某个酒店编写程序:酒店管理系统,模拟订房、退房、打印所有房间状态等功能。

为某个酒店编写程序:酒店管理系统,模拟订房、退房、打印所有房间状态等功能。
1、该系统的用户是:酒店前台.
2、酒店使用一个二维数组来模拟。"Room[][]rooms ; "
3、酒店中的每一个房间应该是一个java对象:Room
4、每一个房间Room应该有:房间编号、房间类型、房间是否空闲.
5、系统应该对外提供的功能:
可以预定房间:用户输入房间编号,订房。可以退房:用户输入房间编号,退房。
可以查看所有房间的状态:用户输入某个指令应该可以查看所有房间状态
```java
public class Room {
   
    private int no;
    private String type;
    private boolean status;
 
    public Room() {
   
    }
 
    public Room(int no, String type, boolean status) {
   
        this.no = no;
        this.type = type;
        this.status = status;
    }
 
    public int getNo() {
   
        return no;
    }
 
    public void setNo(int no) {
   
        this.no = no;
    }
 
    public String getType() {
   
        return type;
    }
 
    public void setType(String type) {
   
        this.type = type;
    }
 
    public boolean isStatus() {
   
        return status;
    }
 
    public void setStatus(boolean status) {
   
        this.status = status;
    }
 
    public String toString(){
   
        return "[房间号:"+no+",房间类型:"+type+",房间状态:"+(status ? "空闲" : "占用")+"]";
    }
  • 6
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值