Design an ATM System
Problem Statement
Design the Low-Level Design (LLD) of an ATM (Automated Teller Machine) system.
The system should simulate how a customer interacts with an ATM to perform banking operations such as cash withdrawal, deposit, and balance inquiry.
Your goal is to define the core classes, relationships, and workflows that model how the ATM functions internally — focusing on object-oriented design principles like abstraction, encapsulation, and polymorphism.
🧠 Functional Requirements
Card Authentication
Account Operations
Check Balance
Withdraw Cash
Deposit Cash
Transfer Funds (optional extension)
Change PIN (optional)
Cash Withdrawal
Deposit Cash
Balance Inquiry
Session Management
Error Handling
🚫 Non-Functional Requirements
🧱 Suggested Classes
ClassResponsibility
ATM
Represents the physical ATM machine — interacts with hardware (card reader, cash dispenser).
Card
Represents a user’s debit/credit card (card number, expiry, PIN, linked account).
BankAccount
Represents the user’s account (balance, account number, type).
User
Represents the account holder.
Transaction
Abstract base class for different transaction types.
WithdrawTransaction, DepositTransaction, BalanceInquiryTransaction
Concrete classes extending Transaction for specific operations.
CashDispenser
Handles dispensing of notes based on available denominations.
CashDepositSlot
Handles cash deposits and validations.
ATMState (Enum or Interface)
Represents the current state of ATM (Idle, CardInserted, Authenticated, Processing, etc.).
BankServer / BankService
Simulates backend communication for balance checks, fund transfers, etc.
🔄 Example Flow
Insert Card
Enter PIN
Select Operation
Withdraw Cash
Eject Card
🧪 Example Input / Output
Input:
1
2Card Inserted: 1234-5678-9012-3456
3Enter PIN: 1234
4Select Option: Withdraw
5Enter Amount: 2500Output:
1
2Dispensed: ₹2000 + ₹500
3Remaining Balance: ₹7500
4Transaction Successful.
5Card Ejected.⚙️ Constraints
🎯 Goals
Your design should:
✅ In short:
Design a modular, object-oriented ATM system that supports card authentication, cash withdrawal, deposits, and balance checks — ensuring clean separation between ATM operations and backend banking logic.