Skip to the guide

Design an ATM

IntermediateCase study12 pages

The interviewer asks you to design the software inside a cash machine. Picture a small branch office with one clerk, a drawer of notes and a telephone to head office, where your balance is kept. The clerk counts your notes onto a tray and then phones. A yes gets you the tray, and a no puts the notes back in the drawer. If the line goes dead, she pays nothing and writes a reminder to ring back and cancel.

The closest other case study is the vending machine, where the money stays inside. Interviewers like the ATM because the money lives somewhere else, so you must decide what happens when the other side says no, or says nothing.

Below is a full 45-minute round on the LLD framework. At each Guess before you read on, stop and answer first. The full runnable project is a download in Java, JavaScript and Python.

Run the full project

This design as a project you can run, with its tests and a demo. You only need Java 21, Node 24 or Python 3.13. The README says how to run it.

Step 1 · Clarify the requirements and cut the scope

Minutes 0–5 · How this step works

Interviewer: Design an ATM.

You: Which transactions do you want, and where does the account live?

Interviewer: A balance check and a cash withdrawal. Accounts are at the bank, over a network.

You: Which notes does it hold, and what is the largest withdrawal?

Interviewer: $100, $50, $20 and $10 notes, and at most $1,000 at a time.

You: How many wrong PINs do you allow, and can two people share an account?

Interviewer: Three, and then the machine keeps the card. And yes, accounts can be shared.

You: What if the bank says yes and the notes jam, or the bank never replies?

Interviewer: You tell me. The customer must not lose money.

You: Then I'll build the PIN, the balance, the withdrawal and each failure. Deposits, receipts and the screen are out. OK?

Interviewer: Good.