Assignment Three
This assignment is to add methods to the class Bank. The additional methods are as follows:
public void deposit(String accountNumber, double amount); This method uses the Bank find method to get the BankAccount object from the accounts ArrayList that matches the accountNumber and deposits the amount into that account. Make the deposit only if the account is open. If the accountNumber is not valid do nothing.
public void withdraw(String accountNumber, double amount); This methods uses the Bank find method as in the deposit method above and withdraws the amount from that account. Make the withdrawal only if the account is open. If the withdraw amount is greater than the account balance suspend the account. If after the withdraw the balance is zero close the account. If the accountNumber is not valid do nothing.
public double getBalance( String accountNumber); “Find” the account corresponding to the accountNumber and return the balance of that account.
public void transfer(String withdrawAccountNumber, String depositAccountNumber, double amount); Transfer amount from the account with withdrawAccountNumber to the account with depositAccountNumber. If the accountNumber is not valid do nothing.
public double getTotalBalance(); Return the sum of the balances of all accounts.
public boolean validAccountNumber(String accountNumber); Return true if accountNumber is a valid account number in Bank; false if not.
public int numberAtLeast(double atLeast); Returns the number of accounts with a balance >= atLeast.
Test your Bank class (and the modified BankAccount class from Lab 4) with main class BankTesterAssignmentThree.
This assignment is due February 25th at the beginning of class. There will be a quiz on the assignment at that time.