Sequence Diagram for the Car Rental System

Create a sequence diagram for online vehicle reservation in the car rental system and solve a challenge.

Sequence diagrams are a great way to understand the interactions between different entities and objects in the system. There can be different sequence diagrams that we can create for our car rental system. For the sake of this lesson, we will create sequence diagrams for the following two interactions:

  • Vehicle reservation: The member reserves a vehicle.

  • Sequence challenge: The member cancels their reservation.

Vehicle reservation

The sequence diagram for vehicle reservation should have the following actors and objects that will interact with each other:

  • Actor: Member

  • Objects: Catalog, Reservation, and Payment

  • System

Here are the steps in the reserve vehicle interaction:

  1. The member searches for a vehicle.

  2. If the vehicle is available:

    1. The catalog returns a list of available vehicles.

    2. The member selects a vehicle to reserve.

    3. The system creates a reservation against the vehicle.

    4. The reservation fee is sent to the system.

    5. The system requests payment from the member.

    6. The member initiates payment against the reservation fee.

    7. The payment is processed.

    8. If the payment is successful:

      1. The system is informed that the payment is completed.

      2. The system updates the reservation status to “confirmed”.

      3. The member is informed that the vehicle is reserved.

    9. Else if the payment is unsuccessful:

      1. The system is informed that the payment has failed.

      2. The system deleted the reservation.

      3. The system informs the member that the reservation is unsuccessful.

  3. Else, if the vehicle is unavailable:

    1. Members are notified that no vehicles are available.

Based on the order above, the sequence diagram of a vehicle reservation in a car rental system is provided below:

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.