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.

  1. Write a Constructor that initializes the ArrayList.
  2. Write a method named addAccount that takes a BankAccount as an input parameter and adds it to the ArrayList.
  3. Write a method that prints out the details of the stored BankAccounts using a for-each loop.
  4. Write a method that iterates through the stored BankAccounts and returns an ArrayList containing only those that have a balance smaller than 100.
  5. Write a method that iterates through the stored BankAccounts and sums up and returns the total balance of all the accounts.
  6. 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!