Open In App

Class diagram for Hotel management system

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,

Attributes :



Methods :

1. Hotel Management :

2. Employees :  

3. Customer : 

4. Table :

5. Menu :

6. Order :

7. Bill :  

8. Payment : 

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.

Here,

  • 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.

Here,  

  • 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.

Here,  

  • 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 :

Article Tags :