Class Diagram for the Hotel Management System
Learn to create a class diagram for the hotel management system problem using the bottom-up approach.
Here, we are going to create the class diagram for our system based on the requirements that we gathered in one of the previous lessons. In the class diagram, we will first design and create the classes, abstract classes, and interfaces for the system, and then we’ll identify the relationship between classes in accordance with all the requirements of the hotel management system.
Components of a hotel management system
In this section, we’ll define the classes for a hotel management system. Since we are following the bottom-up approach to designing a class diagram, we will first create the classes of small components. Next, we will integrate these components and create the class diagram for the hotel management system.
Address and Account
The Address
class is required to store any address. It is a custom data type with attributes like a street address, city, etc. In the hotel management system, this class will be used to specify the addresses of the users and the hotel.
Account
is a class used to store the user’s account information. This class has three members, i.e., account ID, password, and account status. The class representation of Address
and Account
classes is as follows:
Person
Person
is an abstract class used to store information related to a person like a name, email, phone number, etc. In this class, there is an object of the Address
type to specify the person’s address. The Person
class specifies the accounts in the system. There can be four types of accounts in the system,i.e., housekeeper, receptionist, guest, and server.
There are multiple functions of the Person
class’s subclasses. First, the Housekeeper
class will keep track of the housekeeping records of a room. Second, the Receptionist
class represents the hotel receptionist. The methods in this class depict the actions that can be performed by the receptionist. Moreover, the Guest
class describes the guests of the hotel. Guests are the customers of the hotel who can search for and book a room.
The relationship diagram for these classes is shown below:
Service
Service
is an abstract class that encapsulates the details of different types of services that guests have requested. There are three types of services provided—amenity, room service, and kitchen service.
The Amenity
class is a subclass of Service
having two members; name and description. Similarly, RoomService
is also inherited from the Service
class. This class stores information about room services whether these services are chargeable or not and what is the request time of the service. Furthermore, ...