![]() |
VOOZH | about |
We need to design an online hotel booking system where a user can search a hotel in a given city and book it. This is an OOP design question, so I have not written the full code in this solution. I have created the classes and attributes only.
Solution :
Main Classes :
1. User
2. Room
3. Hotel
4. Booking
5. Address
6. Facilities
Let me explain about the classes and the relationships among themselves.
The enums defined here are self-explanatory. The classes User, Room, and Address are also self-explanatory. The class Facilities contains a list of facilities (enum) that the hotel provides. We can add more facilities in the Facility enum if required. The duration class has two attributes "from" and "to", which is obvious.
Now, the class "Hotel" contains:
1. List of rooms (Room class) // this is the list of rooms the hotel has
2. Address class // its address
3. Facilities class // the facilities it has
The class "Booking" contains:
1. User // information about the
2. Hotel // Information about the hotel
3. List of rooms
4. PaymentStatus etc.
Other fields in this class are also self-explanatory.