Bank This class will implement some of the basic functionality of a bank.
- private instance Variables
- An ArrayList to store names as Strings
- An ArrayList storing balances (doubles)
- Constructors
- default constructor
- A constructor with 2 parameters–the names of the account owners and their balances
1 |
public Bank(ArrayList<String> _ownerNames, ArrayList<Double> _startingBalances) |
Methods
- Accessors
1 2 3 4 5 6 7 8 9 10 11 12 |
@returns true if name has a bank account public boolean hasAccount(String personsName); @returns the balance for name's account. public double getBalance(String personsName) public int indexOf(String name) public int lastIndexOf(String name) @ returns array list of names whose balances are at least minimumBalance ArrayList<String> getNames(double minimumBalance) |
- Mutators
1 2 3 4 5 6 7 8 9 10 11 12 |
public void addAccount(String name, double balance) adds an account public void addAccount(String name) adds an account public void setBalance(String name, double balance) public void changeName(String oldName, String newName) changes the name associated with accountNumber public boolean remove(String name) public String toString() |