Question: PART 2: Create two subclasses for Checking and Savings account that extend your Account class from previous assignment. Implement the following in these 2 subclasses:

 PART 2: Create two subclasses for Checking and Savings account that

PART 2: Create two subclasses for Checking and Savings account that extend your Account class from previous assignment. Implement the following in these 2 subclasses:

A Checking account has an overdraft limit (of $5,000), but a Savings account cannot be overdrawn. Override the withdraw method in these subclasses to take care of the overdraft restrictions.

All data and methods are inherited from Account class.

Create constructors for both Checking and Savings account. These constructors

should invoke the constructors of their superclass

**************************************PART 1******************************************

class Account { //data declaration int accountId; double balance; double annualInterestRate; Date dateCreated;

/o arg constructor Account () { accountId = 0; balance = 0.0; annualInterestRate = 0.0; } //constructor with specific id and initial balance & AnnualInterestRate Account(int accountId, double balance, double AnnualInterestRate) { this.accountId = accountId; this.balance = balance; this.annualInterestRate = AnnualInterestRate; } //accessor/mutator methods for accountId, balance, and annualInterestRate public int getaccountId() { return this.accountId; } public double getBalance() { return this.balance; } public double getAnnualInterestRate() { return this.annualInterestRate; } public void setaccountId(int accountId) { this.accountId = accountId; } public void setBalance(double balance) { this.balance = balance; } public void setAnnualInterestRate(double AnnualInterestRate) { this.annualInterestRate = AnnualInterestRate; } //accessor method for dateCreated public void getdateCreated() { return this.dateCreated; } //define method getMonthlyInterestRate double getMonthlyInterestRate() { return annualInterestRate/12; } //define method withdraw double withdraw(double amount) { return balance = balanace-amount; } //define method deposit overloading int deposit(int amount) { return balance + amount; } double deposit(double amount) { return balance + amount; } }

Part 1 of this assignment has already been completed. I just need help with part 2.Please just add on to the code from

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!