Sequence Diagram for the Car Rental System
Create a sequence diagram for online vehicle reservation in the car rental system and solve a challenge.
We'll cover the following...
Sequence diagrams illustrate the flow of messages and method calls between various actors and objects in the system as they participate in a business process. They are invaluable for visualizing how objects collaborate to complete key scenarios.
In this lesson, we will create sequence diagrams for two essential interactions in the car rental system:
Vehicle reservation (the customer reserves a vehicle)
Reservation cancellation (the customer cancels a reservation)
Vehicle reservation
The sequence diagram for vehicle reservation should have the following actors and objects that will interact with each other:
Actors and objects involved:
Actor:
Customer
(orReceptionist
, acting on behalf of a customer)Objects:
VehicleCatalog
,CarRentalSystem
,VehicleReservation
,Payment
,Notification
Interaction steps
Search for vehicle:
Customer
requests to search available vehicles.CarRentalSystem
interacts with theVehicleCatalog
to retrieve available vehicles.VehicleCatalog
returns a list of available vehicles.
Select and reserve vehicle:
Customer
selects a vehicle to reserve.CarRentalSystem
checks if the vehicle is available.If available, the
CarRentalSystem
creates a newVehicleReservation
object.
Payment processing:
CarRentalSystem
calculates the reservation fee.CarRentalSystem
prompts theCustomer
for payment.Customer
initiates the payment (viaPayment
object).Payment
is processed.If successful:
CarRentalSystem
updates the reservation status to “confirmed.”CarRentalSystem
triggers aNotification
to the customer (reservation confirmation).Customer
receives confirmation that the reservation is successful.
If unsuccessful:
CarRentalSystem
deletes/cancels the reservation.CarRentalSystem
triggers aNotification
to the customer (reservation failed).Customer
is notified that the reservation is unsuccessful.
Vehicle unavailability:
If no vehicles are available, the
CarRentalSystem
notifies theCustomer
accordingly.
Based on the order above, the sequence diagram of a vehicle reservation in a car rental system is provided below: