Vending machine flowchart
Insert money, choose a drink, get change. A loop back for more coins and a sold-out branch in one small diagram.
The diagram
Reading it step by step
- 1. Start at 'Start'.
- 2. 'Insert money' is an input or output. Next: 'Choose a drink'.
- 3. 'Choose a drink' is an input or output. Next: 'Sold out?'.
- 4. Decide 'Sold out?': if 'yes', go to 'Ask for another choice'; if 'no', go to 'Money ≥ price ?'.
- 5. 'Ask for another choice' is a processing step. Next: 'Choose a drink'.
- 6. Decide 'Money ≥ price ?': if 'no', go to 'Show the shortfall'; if 'yes', go to 'Drop the drink'.
- 7. 'Show the shortfall' is a processing step. Next: 'Insert money'.
- 8. 'Drop the drink' is a processing step. Next: 'Return change'.
- 9. 'Return change' is a processing step. Next: 'End'.
- 10. End at 'End'.
Shape by shape
| Shape | Symbol | Connections |
|---|---|---|
| Start | Terminator | → Insert money |
| Insert money | Input/output | → Choose a drink · ← Start, Show the shortfall |
| Choose a drink | Input/output | → Sold out? · ← Insert money, Ask for another choice |
| Sold out? | Decision | → Ask for another choice(yes), Money ≥ price ?(no) · ← Choose a drink |
| Ask for another choice | Process | → Choose a drink · ← Sold out? |
| Money ≥ price ? | Decision | → Show the shortfall(no), Drop the drink(yes) · ← Sold out? |
| Show the shortfall | Process | → Insert money · ← Money ≥ price ? |
| Drop the drink | Process | → Return change · ← Money ≥ price ? |
| Return change | Process | → End · ← Drop the drink |
| End | Terminator | ← Return change |
Symbols used here
| Symbol | Meaning |
|---|---|
| Terminator | Where the flow starts or ends; a rounded rectangle. |
| Process | One action such as a calculation; a rectangle. |
| Decision | A question whose answer picks the next path; a diamond. |
| Input/output | Data comes in or goes out; a parallelogram. |
| Flow line | The order of steps, in the arrow direction. |
Diagram text
Paste this text into the editor to get the same picture, then change the names to fit your own work.
# Vending machine flowchart
flowchart TD
s(["Start"])
a[/"Insert money"/]
b[/"Choose a drink"/]
c{"Sold out?"}
d["Ask for another choice"]
e{"Money ≥ price ?"}
f["Show the shortfall"]
g["Drop the drink"]
h["Return change"]
z(["End"])
s --> a
a --> b
b --> c
c -->|yes| d
d --> b
c -->|no| e
e -->|no| f
f --> a
e -->|yes| g
g --> h
h --> z