Loading LLD design...
Design an object - oriented ATM system that supports card - based authentication, cash withdrawal with denomination management, deposits, and balance inquiries.
The system should use a state machine to manage the ATM lifecycle(idle → authentication → transaction selection → cash dispense → idle), implement a greedy denomination algorithm for cash dispensing, and support multiple account types(savings, checking with overdraft).
Card authentication
Insert card and validate PIN to access the account
Cash withdrawal
Withdraw a specified amount if balance and ATM cash are sufficient
Cash deposit
Deposit cash into the account
Balance inquiry
Check the current account balance
Cash dispensing with denominations
Dispense the requested amount using available bill denominations (greedy algorithm)
Transaction logging
Record every transaction with timestamp, type, amount, and status
Card ejection and session end
Eject the card and reset the ATM to idle state
Before diving into code, clarify the use cases and edge cases. Understanding the problem deeply leads to better class design.
Identify the primary actions users will perform. For a parking lot: park vehicle, exit vehicle, check availability. Each becomes a method.
Who interacts with the system? Customers, admins, automated systems? Each actor type may need different interfaces.
What are the limits? Max vehicles, supported vehicle types, payment methods. Constraints drive your data structures.
What happens on overflow? Concurrent access? Payment failures? Thinking about edge cases reveals hidden complexity.