Description
Write Java Program for ATM machines
Two Banks (Bank A & B)
Hard Code, 2 customers for Bank A with $50 in the account (each customer have their own cash cards)
Hard Code, 3 customers for Bank B with $50 in the account (each customer have their own cash cards)
Cash Cards come with expiration date and withdraw transaction only.
Design 2 ATM machines (ATM_A1 & ATM_A2) for Bank A
Design 2 ATM machines (ATM_B1 & ATM_B2) for Bank B
Each ATM machine take their own bank’s cash card’s account number, password, and expiration date.
Requirements are:
Bank A only work with ATM_A1 & ATM_A2
Bank B only work with ATM_B1 & ATM_B2
When accounts are verified, customers can withdraw money on their cash card’s balance.
NOTE: error messages should show if the requirements are not met. For example, Bank A cash card try
to withdraw money from Bank B ATM machines vice versa. Customers withdraw more than account
balance. (see sample output below).
At least 4 or 5 different classes (for example, ATMSystem.java, ATM.java, Bank.java, CashCard.java,
Customer.java, BankDatabase.java, or …) that has is-a (inheritance classes) or has-a relationship.
Javadoc each class such that /**@param*/ /**@return */
If possible, include use cases or UML
Sample Output
State of 2 Banks //Hard code started
Set accounts $50 preloaded.
BankA (2 customers)
Customer with Cash Card (bankid: A, account number 11, expires on 12/12/16,
password aaa
Customer with Cash Card (bankid: A, account number 12, expires on 05/01/17,
password bbb
BankB (three customers)
Customer with Cash Card (bankid: B, account number 111), expires on 11/11/11,
password ccc
Customer with Cash Card (bankid: B, account number 112), expires on 12/12/12,
password ddd
Customer with Cash Card (bankid: B, account number 113), expires on 12/12/17,
password eee
State of 4 ATMs (2 for each Bank)
ATM1_A: (ATM1 from BankA)
The maximum amount of cash a card can widthraw per day: $60
ATM2_A: (ATM1 from BankA)
The maximum amount of cash a card can widthraw per day: $60
ATM1_B: (ATM1 from BankB)
The maximum amount of cash a card can widthraw per day: $60
ATM2_B: (ATM1 from BankB)
The maximum amount of cash a card can widthraw per day: $60
//Hard code ended
//User input started
% Enter your choice of ATM
ATM1_A
% Enter your card
11
“This card is expired please enter different card”
/*if enter 12, then OK because not expired & correct card */
% Enter your card
112
“This card is not supported by this ATM Enter your card again”
% 12
“The card is accepted”
% Please enter your password
aaa
“This is a wrong password. Enter correct password”
% Please enter your password
bbb
“Authorization is accepted”
% Please enter withdraw amount.
100
“This amount exceeds the max can withdraw per transaction. Please enter the
amount or quit”
% Please enter withdraw amount.
25
“$25 is withdrawn from your account. The remaining balance of this account
is $25. If you have more withdraw transactions, enter the amount or quit”
% Please enter withdraw amount.
55
“This amount exceeds the current balance. Enter another amount or quit.
% 15
“$25 is withdrawn from your account. The remaining balance of this account
is $0. If you have more transactions, enter the amount or quit.
quit
//users input ended