Question: Task #1 Extending the BankAccount Class 1. Copy the files AccountDriver.java (Code Listing 10.1) and BankAccount.java (Code Listing 10.2) from the Student CD or as
Task #1 Extending the BankAccount Class
1. Copy the files AccountDriver.java (Code Listing 10.1) and BankAccount.java (Code Listing 10.2) from the Student CD or as directed by your instructor. BankAccount.java is complete and will not need to be modified.
2. Create a new class called CheckingAccount that extends BankAccount.
3. It should contain a static constant FEE that represents the cost of clearing one check. Set it equal to 15 cents.
4. Write a constructor that takes a name and an initial amount as parameters. It should call the constructor for the superclass. It should initialize accountNumber to be the current value in accountNumber concatenated with 10 (All checking accounts at this bank are identified by the extension 10). There can be only one checking account for each account number. Remember since accountNumber is a private member in BankAccount, it must be changed through a mutator method.
5. Write a new instance method, withdraw, that overrides the withdraw method in the superclass. This method should take the amount to withdraw, add to it the fee for check clearing, and call the withdraw method from the superclass. Remember that to override the method, it must have the same method heading. Notice that the withdraw method from the superclass returns true or false depending if it was able to complete the withdrawal or not. The method that overrides it must also return the same true or false that was returned from the call to the withdraw method from the superclass.
6. Compile and debug this class. Use the AccountDriver class to test out your classes. If you named and created your classes and methods correctly, it should not have any difficulties. If you have errors, do not edit the AccountDriver class. You must make your classes work with this program.
9. You do not need to work on the SavingsAccount. Please just comment out (or remove) the code pertaining to the SavingsAccount portion in AccountDriver.java. Just keep the code pertaining to CheckingAccount and work with it.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
