Question: Java lab Design and write 3 classes Account, CheckingAccount, and SavingsAccount. Have CheckingAccount and SavingsAccount inherit from Account. In Account, you should include an account

Java lab

Design and write 3 classes Account, CheckingAccount, and SavingsAccount. Have CheckingAccount and SavingsAccount inherit from Account. In Account, you 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, make 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 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. Override the toString method to display everything the Account toString displays plus the minimum balance. Use the parent class toString to do most of the work.

In the SavingsAccount class 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, make sure to calculate the interest accordingly. Override the toString method to display everything the Account toString displays plus the interest rate separately. Like the CheckingAccount toString, you 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.

Create a driver class to instantiate and exercise each of the account types. Be sure that your driver uses descriptive output and tests each of the features of your account types. You can create a menu if you wish.

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!