Question: Create a class named BigBank . This class should have one instance variable, an ArrayList that holds a collection of BankAccounts. Write a Constructor that
Create a class named BigBank. This class should have one instance variable, an ArrayList that holds a collection of BankAccounts.
- Write a Constructor that initializes the ArrayList.
- Write a method named addAccount that takes a BankAccount as an input parameter and adds it to the ArrayList.
- Write a method that prints out the details of the stored BankAccounts using a for-each loop.
- Write a method that iterates through the stored BankAccounts and returns an ArrayList containing only those that have a balance smaller than 100.
- Write a method that iterates through the stored BankAccounts and sums up and returns the total balance of all the accounts.
- Write a method that removes all BankAccounts with a balance of zero.
Be sure to test your BigBank carefully. Write a class named BigBankTester that has a method named testBigBank that tests the constructor and all the methods. The method should print enough information so that you can look in the Terminal Window and see that everything worked properly.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
