PrepZone Logo
PrepZone
Back to LLD

LLD · Medium

Design a vending machine (State pattern).

LLDMachines & DevicesDesign PatternsSenior

Answer preview

Canonical State pattern problem. Machine cycles through Idle → HasMoney → Dispensing → Idle. Behaviour depends entirely on the current state.…