Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 31st International Conference Dexa 2020 Bratislava Slovakia September 14 17 2020 Proceedings Part 1 Lncs 12391

Authors: Sven Hartmann ,Josef Kung ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

303059002X, 978-3030590024

More Books

Students also viewed these Databases questions

Question

What is management growth? What are its factors

Answered: 1 week ago

Question

Which personal relationships influenced you the most?

Answered: 1 week ago