Write a BankAccount
class that has an int
account number and a double
balance for instance variables. Overloaded constructors take either an account number and no balance (in which case the balance is initialized to 0), or an account number and a balance. Then write four methods for the class:
getAccountNumber()
deposit(float amount)
withdraw(float amount)
getBalance()
Write a Bank
class that uses an ArrayList
to keep track of a series of BankAccount
objects. The constructor creates a Bank
instance with no bank accounts to begin with. Methods to write for this class include:
addAccount(BankAccount a)
-- adds the specified bank account to the bankgetTotalBalance()
-- returns the total value of all the accounts in the bankcount(double minimum)
-- returns the number of accounts at the bank that have at least the specified minimum balancefind(int accountNumber)
-- returns the BankAccount
object with the indicated account number. Returns null
if no matching account number is found.getMaximum()
-- returns the BankAccount
with the largest balancedeposit(int accountNumber, double amount)
-- adds the indicated amount to the BankAccount
with the specified account numberwithdraw(int accountNumber, double amount)
-- withdraws the indicated amount from the BankAccount
with the specified account numbergetBalance(int accountNumber)
-- returns the balance from the BankAccount
with the specified account number