Back to All 30 System Design Questions
LLDEasyQuestion 25 of 30
Design a Vending Machine (Finite State Machine)
Design a clean, object-oriented Vending Machine utilizing the State Design Pattern to model coins insertion, item selection, dispensing, change return, and out-of-order maintenance states.
Asked by:AmazonMicrosoftAdobe
#Low Level Design#State Pattern#Object Oriented Design#Finite State Machine#Cash Flow
Object-Oriented Class Hierarchy
Compiling architecture diagram...
Vending Machine FSM
Applies the State Design Pattern to encapsulate hardware state transitions (Idle, HasMoney, Dispensing, Refunding), cleanly enforcing valid actions per state while maintaining all monetary calculations in integer cents.