Activity Diagram for the Vending Machine
Create an activity diagram for the vending machine.
We'll cover the following...
Activity diagrams are a great way to visualize the flow of messages from one activity to another in the system. We can create different activity diagrams for our vending machine. In this lesson, we will create an activity diagram for purchasing a product from the vending machine.
Product purchase from the vending machine
The following are the states and actions involved in this activity diagram.
States
Initial state: The customer inserts money into the vending machine.
Final state: The customer receives the desired product.
Actions
The customer interacts with the vending machine and inserts money. The customer selects their desired product. If that product is available, they get the product and the change. Otherwise, the system shows a message of product unavailability and asks the customer to select another product.
Based on the order above, the activity diagram of a product purchase from the vending machine is shown below: