Design
Coffee Vending Machine
Design a coffee vending machine that accepts coin denominations, lets customers select a beverage, deducts ingredients, dispenses the drink, and returns change. Admins can restock ingredients and collect cash.
01 - Why interviewers ask this
Coffee/Vending Machine is a classic OOP interview question that tests your ability to model real-world state transitions, enforce business rules (insufficient funds, out-of-stock), and apply design patterns like State and Command in a hardware-software boundary context.
02 - Where this system exists in the real world
You interact with this design every day.
Embedded systems in office pantries, airports, and hospitals
Foundation for understanding State Machine design in hardware controllers
Blueprint for POS (point-of-sale) systems with inventory management
Demonstrates concurrent resource management in physical device software
03 - What you'll master
Solve this once. Know it forever.
Design a finite state machine with valid transitions and guards
Apply the State pattern to eliminate complex conditional logic
Handle inventory deduction atomically to prevent partial dispense
Separate admin operations from customer-facing flows using modes
04 - What you'll design
8 functional · 3 non-functional requirements.
Accept multiple coin denominations (₹1, ₹2, ₹5, ₹10)
7 more requirements inside
Sign in to unlock the full brief and start designing
05 - Companies that ask this
You may face this exact question in your next interview.
Ready?
Open the canvas.
Design it yourself.
See all requirements, use staged hints, run your code, and compare with community discussions - all on the same canvas.
Start SolvingMore in Infrastructure