...

/

Use Case Diagram for the Vending Machine

Use Case Diagram for the Vending Machine

Learn how to define use cases and create the corresponding use case diagram for the vending machine.

Let’s build the use case diagram for the Vending Machine system and understand the relationships between its main actors and functions. First, we’ll define the different elements of our system, followed by the complete use case diagram.

System

Our system is the Vending Machine. It manages automated product selection, payment, and goods dispensing through a self-service interface.

Actors

Now, we’ll define the main actors of our vending machine.

Primary actors

  • Customer: Can view available products, select products to purchase, insert money, collect dispensed products, and receive change.

  • Operator: Inherits all Customer actions. Additionally, the operator can add new products, remove products, and remove collected cash from the machine.

Use cases

In this section, we will define the vending machine’s use cases. We have listed them according to their respective interactions with a particular actor.

Customer

  • View products: View all available products in the vending machine.

  • Select product: Select a product to buy by specifying the rack or slot number.

  • Insert money: Insert cash to pay for the selected product.

  • Take product: Collect the dispensed product from the vending machine.

  • Take change: Collect change, if any, after the transaction.

Operator

Inherits all Customer actions, plus:

  • Add product: Add new products to the vending machine.

  • Remove product: Remove products from the vending machine.

  • Remove cash: Remove cash collected from the machine.

System

  • Search product: Find and verify the selected product’s availability in the machine.

  • Validate money: Makes sure that the user has inserted enough money to buy the selected product.

  • Dispense product: Dispense the selected product to the user.

  • Return change: Return change to the customer if the inserted amount exceeds the product price.

Relationships

This section describes the relationships between and among actors and their use cases.

Generalization

The Operator is a specialized role that extends the Customer’s capabilities (inherits all Customer use cases, plus additional administrative ones).

Associations

The table below shows the association relationship between actors and their use cases.