Bank Class

Bank Class

You have a lot of flexibility in creating this class, but here is what it should be able to do

Functionality that you *must* implement.

It’s up to you to decide how to implement the functionality below. You will only lose credit if your methods clearly make no sense, have bad variable names/method names.

  • add an Account  (of any type)
  • remove an account by
    • account id
    • owner (a Person object)

The functionality above ^^ can be implemented in any efficient way that makes sense, but it must be implemented. I am leaving that part up to you!


  • Some Specific Required Methods
    • public ArrayList<Person>  topAccountOwners(double cutoff)
      • this method returns an ArrayList of the owners whose accounts have at least cutoff  amount of balance
    • public void nightlyUpdate()
      • this runs through the accounts and if account is a SavingsAccount , then it calls that object’s recordDailyBalance()  method (You are going to have to use instanceOf  and then cast those  accounts to a  SavingsAccount )
    • public  Account topBalance()   ; returns the Account  object with the greatest balance
    • public  Account[] allWithinRange(double min, double max) returns an array of Accounts whose balances range from min  to max , inclusive
    • public  boolean transfer( double amount, int accountIdFrom , int accountIdTo) ;  this method transfers  money from the one account to the other. If the accountIdFrom  does not have enough $$, this method returns false.
    • public  void monthlyUpdate()
      • this runs through the accounts and if
      • account is a SavingsAccount , then it calls that object’s updateInterestPayment() method
    • ** extra credit ArrayList<Account> sortByAmount()  
      •   this method returns an arraylist of Accounts sorted by amount in the account

 

account_with_bank_no_labels