Sequence Diagram for the Parking Lot

Create a sequence diagram for the card payment in the parking lot system and solve a challenge.

A sequence diagram is 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 parking lot system. For the sake of this lesson, we will create sequence diagrams for the following two interactions:

  • Card payment: This performs a payment using the card.

  • Sequence challenge: This is for payment verification.

Card payment

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

  • Actor: Customer

  • Object: CardReader, Payment, and ExitPanel

Here are the steps in the card payment interaction:

  1. The customer inserts the card into the card reader.

  2. The card reader initiates a payment for the required parking fee.

  3. The payment processes the payment and returns the payment status.

  4. The card reader ejects the card.

  5. If the payment is successful:

    1. The customer requests a receipt for the transaction.

    2. The exit panel prints a receipt for the customer.

  6. If the payment is unsuccessful:

    1. The customer sees an error message for an unsuccessful Payment.

Note: The Payment object is created when a vehicle enters the parking lot.

Based on the order above, the sequence diagram of the card payment in a parking lot system is given below.

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