zoukankan      html  css  js  c++  java
  • OO问题

    设计一个在线的酒店预订系统,并且可以通过城市搜索出来

    解决办法:

    Main Class:
    User Room Hotel Booking Adress Enums : 房间的状态和类型
    public enum RoomStatus { EMPTY NOT_EMPTY; } public enum RoomType{ SINGLE, DOUBLE, TRIPLE; } public enum PaymentStatus { PAID, UNPAID; } class User{ int userId; String name; Date dateOfBirth; String mobNo; String emailId; String sex; } // For the room in any hotel class Room{ int roomId; int hotelId; RoomType roomType; RoomStatus roomStatus; } class Hotel{ int hotelId; String hotelName; Adress adress; List<Room> rooms; // hotel contains the list of rooms float rating; Facilities facilities; } // a new booking is created for each booking done by any user class Booking{ int bookingId; int userId; int hotelId; List<Rooms> bookedRooms; int amount; PaymentStatus status_of_payment; Time bookingTime; Duration duration; } class Address{ string city; string pinCode; string streetNo; string landmark; } class Duration{ Time from; Tiime to; } class Facilities{ bool provides_lift; bool provides_power_backup; bool provides_hot_water; bool provides_breakfast_free; }

    但如何跟踪多用户的的房间,所以我觉得这里房间改成接口更好,然后不同类型的房间继承room,并且发布不同的价格。



  • 相关阅读:
    java 日志框架的选择Log4j->SLF4j->Logback
    linux上的常用命令
    Zookeeper配置Kafka
    分布式日志收集框架Flume
    Spark Streaming简介
    Spring Cloud学习笔记之微服务架构
    IntelliJ IDEA学习记录
    firefox插件-自动化测试工具-selenium IDE
    大数据01
    使用java开发spark的wordcount程序(多种实现)
  • 原文地址:https://www.cnblogs.com/Kunrong/p/9399560.html
Copyright © 2011-2022 走看看