All problems
Foundational·🏪 Retail·Apple · Google · Samsung

Design
Vending Machine

Design a vending machine that dispenses products, handles payment, and manages inventory.

#State Machine#OOP
Start Solving 7F + 4NF requirements inside

01 -  Why interviewers ask this

It's the textbook example for the State pattern — interviewers use it to check that you model states as objects instead of littering the code with if/else flags.

02 -  Where this system exists in the real world

You interact with this design every day.

Snack, drink, and ticket vending machines

Self-checkout kiosks with cash/card acceptance

Automated parcel lockers with item dispensing

03 -  What you'll master

Solve this once. Know it forever.

01

Apply the State pattern to a physical workflow

02

Model coin/note insertion, change, and refunds

03

Handle out-of-stock and insufficient-payment edge cases

04 -  What you'll design

7 functional · 4 non-functional requirements.

Display available products with prices

6 more requirements inside

Sign in to unlock the full brief and start designing

Unlock Requirements

05 -  Companies that ask this

You may face this exact question in your next interview.

A
Apple
G
Google
S
Samsung

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 Solving