Question: We have to design 3 classes - Account, CheckingAccount, and SavingsAccount. CheckingAccount and SavingsAccount inherit from Account. In Account, we should include an account number,
We have to design 3 classes - Account, CheckingAccount, and SavingsAccount. CheckingAccount and SavingsAccount inherit from Account. In Account, we should include an account number, an account balance, a deposit and toString method, and an abstract withdraw method. Since deposits work the same way in both child classes, we should be sure they cannot override it. The constructor should only take an initial deposit amount to start along with generating an account number. The toString should display the account number and the current balance.
In the CheckingAccount class we have to add a minimum balance requirement and overdraft fee. Implement the withdraw method so that overdrafts are allowed, but the overdraft fee is incurred if the balance drops below the minimum balance. We have to override the toString method to display everything the Account toString displays and the minimum balance. We have to use the parent class toString to do most of the work.
In the SavingsAccount class we have to add an annual interest rate and a method to recalculate the balance when the interest rate method is called. Since the interest rate is annual, we should be sure to calculate the interest accordingly. We have to override the toString method to display everything the Account toString displays plus the interest rate separately. Like the CheckingAccount toString, we should use the parent class to do most of the work. Also in the SavingsAccount class, if the current balance is less than $100.00, display an "account balance low" warning message along with the balance. Additionally, subtract $5.00 from the account balance as a fine for the low balance.
We need to make a driver class to instantiate and exercise each of the account types. We need to be sure that your driver uses descriptive output and tests each of the features of our account types. We can make Menu if we want.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
