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 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 fromStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started