Skip to content
Related Articles
Open in App
Not now

Related Articles

Class diagram for Hotel management system

Improve Article
Save Article
  • Difficulty Level : Medium
  • Last Updated : 22 Oct, 2021
Improve Article
Save Article

Class diagram is a type of UML diagram which shows the properties and relationships among various objects.

Class :

The classes used in this system are,

  • Hotel Management : This class depicts the entire hotel and says whether the hotel is opened or closed.
  • Employees : It contains the details of the Employee. There are two kinds of employees, Server and the chef. This employee class is the parent class of two subclass – Server and Chef
  • Server : It contains the details of the server, the table to which they are assigned, the order which is currently serving, etc.
  • Chef : It contains the details of the chef working on a particular order.
  • Customer : It contains the details of the customer.
  • Table : It contains the table details like table number and the server who are assigned to that table.
  • Menu : Menu contains all the food items available in the restaurant, their availability, prize, etc.
  • Order : Order depicts the order associated with a particular table and the customer.
  • Bill : Bill is calculated using the order and menu.
  • Payment : This class is for doing payment. The payment can be done in two ways either cash or card. So payment is the parent class and cash and card are subclasses.
  • Cash : Payment can be done by cash
  • Card : Payment can be done by  card or online

Attributes :

  • Hotel Management – HotelName, NumberOfEmployees
  • Employees – EmployeeId, EmployeeName, EmployeeSalary
  • Server – ServerId, OrderId
  • Chef –  Chef_Id, OrderId
  • Customer – CustomerId, CustomerName, Bill_Id, OrderId, PaymentId
  • Table – TableNumber, OccupiedStatus, ServerId, CustomerId
  • Menu – ItemId, ItemName, Amount
  • Order – OrderId, ItemId, ItemName, Quantity, CustomerId, ServerId
  • Bill – Bill_Id, OrderId, TotalBill
  • Payment – PaymentId, Bill_Id

Methods :

1. Hotel Management :

  • open() -This is used to indicate if the hotel is functioning or not.

2. Employees :  

  • employee details() – This method contains the details of the employee.

3. Customer : 

  • customer_details() – This depicts the details of the customer.
  • ordered_items() – This method contains the items which are ordered by the customer.
  • payment_status() -This says whether the customer paid or not.

4. Table :

  • table_details() – This method contains the details of the table along with the customer and no of seats.
  • availability_status() – This method says whether the table is occupied or not.

5. Menu :

  • items() – This method displays the menu items, their availability and their price.

6. Order :

  • order_items() – This method orders the items selected by the user from the menu.

7. Bill :  

  • calculate_bill() – This method calculates the bill for a particular table.

8. Payment : 

  • ispaid() – It shows whether payment is successful or not.

Relationships :

Inheritance :

Inheritance is “is a relationship”. It has a parent class and its corresponding child classes. The child class inherits the methods and attributes which are required for it from the parent class.

Here, Employee is parent class Server and Chef are child classes because server is a employee and chef is a employee.

Association :

In Association, both classes are related to each other but are not physically contained with one another. It is known as “using” relation. In association relation, consider we have two classes A and B where class A calls class B and Class B also calls class A.


  • Employee and customer
  • Server and table
  • Customer and payment
  • Chef and order

follows association relationships.

Composition :

It is also called as “Has a” relationship where class A has an instance of class B, Class B is composed inside class A and cannot exist independently without class A. So in composition one class is entirely dependent on another class and is physically contained inside it.


  • Menu and Order
  • Order and Bill
  • Bill and Payment

follows composition relation

      Order cannot exist without Menu, Bill cannot exist without order and payment cannot exist without bill. So here order is contained inside the menu, bill is contained inside the order and payment is contained inside the bill.

Aggregation :

It is also called as “Has a” relationship where class A has an instance of class B, but class B is not composed inside class A and can exist independently without class A. So in aggregation, both the classes depend on each other and use each other but none of them are contained inside one another.


  • Customer  and  Server
  • Chef and Server

follows  Aggregation relation

     Server is associated with the customer but can exist without the customer as well, Likewise Chef is associated with the server but can exist without the server as well.

Notations :

Class Diagram :

My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!