Remember not to create packages. Use the default package
12A
In this problem, you will write a tester class PolymorphismRunner. You are provided with three classes: BankAccount, SavingsAccount and CheckingAccount
Add the code described below to the main method
Create an array of BankAccounts that can hold 5 objects. You will fill the array with the objects specified in the table
| Index | Type | InitialBalance |
InterestRate |
Transaction Fee |
|---|---|---|---|---|
| 0 | BankAccount | 1000 | ||
| 1 | SavingsAccount | 1000 | .01 | |
| 2 | CheckingAccont | 3000 | $3 | |
| 3 | SavingsAccount | 1000 | .01 | |
| 4 | SavingsAccount | 2000 | .012 |
Loop through the array
Your output should look like this
Balance: 1090.00
Balance: 1100.01
Interest: 0.01
Balance: 3094.00
Balance: 1100.01
Interest: 0.01
Balance: 2100.02
Interest: 0.012
12B
In both the BankAccount and SavingsAccount provided, override the toString and equals methods.
12C
In both Critter and LethargicCritter classes from 11c, add equals and toString methods. In the Critter class toString method, you will need to get a string representation of the history ArrayList. You can can do that by calling history.toString(). Call super.toString in LethargicCritter's toString