...

/

Sequence Diagram for the Parking Lot

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

  • Objects: ExitPanel, ParkingRate, ParkingTicket, and Payment

Interaction steps:

  1. The customer inserts their parking ticket and card into the exit panel.

  2. The ExitPanel validates the parking ticket.

  3. Based on the ticket details, the ExitPanel requests the ParkingRate object to calculate the total parking fee.

  4. The ExitPanel creates a Payment object (of type CreditCard) and initiates the transaction.

  5. The Payment object processes the card transaction and returns a PaymentStatus (success or failure) to the ExitPanel.

  6. The ExitPanel prompts the customer to remove their card.

  7. If the payment is successful:

    1. The customer may request a receipt.

    2. The ExitPanel prints the receipt.

    3. The exit gate is opened to allow the vehicle to leave.

  8. If the payment is unsuccessful:

    1. The ExitPanel displays an error message and may prompt the customer to retry.

Note: The Payment object for the card transaction is typically created when the customer is ready to exit and the fee has been calculated.

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