...

/

Class Diagram for the Car Rental System

Class Diagram for the Car Rental System

Learn to create a class diagram for the car rental system problem using the bottom-up approach.

Now, we’ll create the class diagram for the car rental system on the basis of the given requirements. In the class diagram, we will first identify classes (concrete, abstract, or associated) and interfaces for the system. Then, we will determine the relationship between them, according to the requirements in the previous lesson.

Components of a car rental system

As mentioned earlier, we’ll design the car rental system using a bottom-up approach.

Address and person

The Address class is a reusable value object that represents a physical address within the car rental system. This class standardizes the way addresses are stored and referenced for customers, staff, and branches. It contains attributes such as street address, city, state/province, postal/zip code, and country.

The Person class is an abstract base class that encapsulates common personal information for all individuals in the system, including customers, receptionists, and workers. This class centralizes attributes and methods shared by all people in the system, promoting code reuse and maintainability. The class representation of Address and Person is given below:

No change in the class representation of these classes.

Press + to interact
The class diagram of the Address and Person classes
The class diagram of the Address and Person classes

Account

The Account class represents the login and system access credentials for a person. It is an abstract class because only specific user roles (Customer, Receptionist, Worker) actually log into the system. The Account class manages authentication, authorization, and account state. This class has members like account ID, password, the status of an account, etc.

The Customer class represents the customers who can register, log in, make vehicle reservations, manage their bookings, make payments, and receive notifications, while the Receptionist is responsible for managing vehicles, reservations, and branch operations. Receptionists inherit all Customer privileges, plus the ability to administer inventory and operations for their branch.

The class representation of Account and its subclasses is given below:

Press + to interact
The class diagram of the Account class
The class diagram of the Account class

Driver

Since we are designing the car rental problem, we will have a Driver class. A customer can request an additional driver at the time of reservation. The class diagram is shown below:

Press + to interact
The class diagram of the Driver class
The class diagram of the Driver class

Vehicle

Our car rental system should have a vehicle object according to the requirements. The vehicle can be of four types: a car, truck, van, and motorcycle. For this purpose, we’ll create Vehicle as an abstract class and Car, Truck, Van, and Motorcycle as its subclasses, as shown in the figure below:

Press + to interact
The class diagram of Vehicle and its derived classes
The class diagram of Vehicle and its derived classes

Equipment

Equipment is an abstract class that stores information about different types of equipment that can be added to the reservation. For simplicity, we’ll assume three types of equipment, i.e., navigation, child seat, and ski rack. The class diagram for Equipment and its subclasses is as follows:

Press + to interact
The class diagram of Equipment and its derived classes
The class diagram of Equipment and its derived classes
...