Design An ATM
Design An ATM
Design an ATM
ATM
The user can have two types of accounts: 1) Checking, and 2) Savings,
and should be able to perform the following five transactions on the
ATM:
The ATM will be managed by an operator, who operates the ATM and
refills it with cash and receipts. The ATM will serve one customer at a
time and should not shut down while serving. To begin a transaction
in the ATM, the user should insert their ATM card, which will contain
their account information. Then, the user should enter their Personal
Identification Number (PIN) for authentication. The ATM will send
the user’s information to the bank for authentication; without
authentication, the user cannot perform any transaction/service.
The user’s ATM card will be kept in the ATM until the user ends a
session. For example, the user can end a session at any time by
pressing the cancel button, and the ATM Card will be ejected. The
ATM will maintain an internal log of transactions that contains
information about hardware failures; this log will be used by the ATM
operator to resolve any issues.
1. Identify the system user through their PIN.
(/learn)
2. In the case of depositing checks, the amount of the check will not
be added instantly to the user account; it is subject to manual
verification and bank approval.
3. It is assumed that the bank manager will have access to the
ATM’s system information stored in the bank database.
4. It is assumed that user deposits will not be added to their
account immediately because it will be subject to verification by
the bank.
5. It is assumed the ATM card is the main player when it comes to
security; users will authenticate themselves with their debit card
and security pin.
Use cases
Here are the actors of the ATM system and their use cases:
Balance inquiry
Deposit cash
<<extends>>
<<extends>>
Deposit
<<extends>>
Transaction <<extends>>
Deposit check
<<extends>> Cash withdraw
<<extends>>
Transfer
Login/Logout
Block/Unblock
Change pin account
Customer
Bank
System startup
Check remaining
cash
Manager
Generate report System shutdown
Class diagram
Keypad: The user will use the ATM’s keypad to enter their PIN or
amounts.
Screen: Users will be shown all messages on the screen and they
will select different transactions by touching the screen.
Bank: To encapsulate the bank which ownns the ATM. The bank
will hold all the account information and the ATM will
communicate with the bank to perform customer transactions.
Card: Encapsulating the ATM card that the customer will use to
authenticate themselves. Each customer can have one card.
ClassName
property_name: type Class: Every class can have properties and methods.
Abstract classes are identified by their Italic names.
method(): type
A B Generalization: A implements B.
Activity Diagram
[yes]
[yes]
[no]
Display Menu
Show error
[Predefined amount]
Enter amount
Is amount [yes]
greater than the Notify Customer
balance?
[no]
[yes]
Print
receipt?
Print receipt
[no]
is amount [no]
correct?
Add to balance
Print receipt
[no]
Sequence Diagram
getBalance(Account)
balanceInquiryTransaction(Account)
getBalance()
getBalance()
Balance
Balance
Balance
displayMessage(Balance)
showMessage()
Code
Here is the skeleton code for the classes defined above:
(/learn)
Enums and Constants: Here are the required enums, data types, and
constants:
Java Python
Java Python
// For simplicity, we are not defining getter and setter functions. The read
(/learn)attributes are private and accessed through their
// assume that all class
// public getter method and modified only through their public setter funct
Java Python
public class Bank {
(/learn)
private String name;
private String bankCode;
Java Python
← Back Next →
(/courses/grokking- (/courses/grokking-
Completed
the- the-
object- object-
oriented- oriented-
Design a Movie Ticket Booking System
design- Design an Airline Management System
design-
interview/gxkvNgMqDk3) interview/RMjqP6Vw98R)
Stuck? DISCUSS
Get (https://discuss.educative.io/c/grokking-the-object-oriented- 8
Send
help on design-interview-design-gurus/object-oriented-design-
(/learn) Recommendations
feedback
case-studies-design-an-atm)