Just one programming problem.
Have the following classes in a file called ATM.java. ATM: CashDispenser, DepositUnit, ReceiptPrinter, CardReader, IOUnit and Atm. Note that only Atm class will be public in this file. The interfaces of these classes remain the same.
Implement the following methods as follows:
readCard() of CardReader asks for the card number from the user, reads it and returns it.
handleTransaction() of ATM:
a) Ask the user to enter the pin. Verify the pin via the verify() method of the bank. If the pin is verified, continue with the transaction. Allow user to enter the pin number up to three times. After the three trials, if the user cannot provide the correct pin, confiscate the card and finish the transaction.
b) Now that BankServer methods will be implemented, handleTransaction should change accordingly. For example, after a deposit, it should print the total amount in the account. Also, before a withdraw, it should verify the availability of funds via the new BankServer method verifyBank().
Have the following classes in a file named BankServer.java. Account, SavingsAccount, CheckingAccount and BankServer where only BankServer is a public class. You will define Java classes for Account, SavingsAccount and CheckingAccount concepts. applyMonthlyInterest() will calculate the monthly interest and add it to the balance. Implement deposit() method in CheckingAccount class, lastDepositDate and lastDepositAmount fields are updated.
The existing public interface of the BankServer class remain the same. You need to introduce private loadAccounts() and public verifyFunds() methods. You should implement the methods as described below:
• loadAccounts() reads a input file that contains the account information and create
the account objects. A sample input file is shown below
The first field is either an S for a savings account or a C for a checking account. The
remaining fields for savings account are account id, customer id, pin, balance and
interest rate. Other fields for checking account are account id, customer id, pin,
balance, amount of last deposit, year, month, day, hour and minutes of the last deposit
date. loadAccount() should read this file and create account objects. Call this method
in the constructor of BankServer with the name of the input file.
• verifyFunds() method, you will search for the account and if it exists make sure its
balance is greater than or equal to the amount. In all of the BankServer methods, use
the account number that you read with readCard() method of the IOUnit class as the
key for searching the accounts.
Implement all other necessary methods described in UML diagram as needed to
compile and run your program.
Create ManageBankAccounts.java and define a main function that creates a bank server
object and an ATM object. Call the handleTransaction() method on the ATM object.
Let’s block ads! (Why?)