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 the other in the system. There can be different activity diagrams that we can create for our vending machine. In this lesson, we will create an activity diagram for the following activity.
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 in 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 some other product.
Based on the order above, the activity diagram of a product purchase from the vending machine is shown below:
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.