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,并且发布不同的价格。



  • 相关阅读:
    二叉树层次遍历
    链表
    线段树加离散化
    前缀和
    RMQ(Range MinimumQuery)问题之ST算法
    2016"百度之星"
    2016"百度之星"
    Dragon Balls[HDU3635]
    Building Block[HDU2818]
    Dogs[HDU2822]
  • 原文地址:https://www.cnblogs.com/Kunrong/p/9399560.html
Copyright © 2011-2022 走看看