Search⌘ K

Class Diagram for the Car Rental System

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

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

Components of a car rental system

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

Address and person

The Address class is a reusable value object representing a physical address within the car rental system. This class standardizes storing and referencing addresses 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 everyone 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.

The class diagram of the Address and Person classes
The class diagram of the Address and Person classes

Account

The Account class represents a person’s login and system access credentials. It is an abstract class because only specific user roles (customer, receptionist, worker) log into the system. The Account class manages authentication, authorization, and account state. This class has members like account ID, password, account status, etc.

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

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

The class diagram of the Account class
The class diagram of the Account class

Driver

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

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, a truck, a van, or a 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:

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:

The class diagram of Equipment and its derived classes
The class diagram of Equipment and its derived classes

Service

Service is an abstract class that ...