Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write in java STAGE 1 : ( The Account class ) Design a class named Account.java that contains: A protected int data field named id

write in java STAGE 1: (The Account class) Design a class named Account.java that contains: A protected int data field named id for the account (default 0). A protected double data field named balance for the account (default 0). A protected Date data field named dateOpened that stores the date when theaccount was created. A no-arg constructor that creates a default account. A constructor that creates an account with a given account id, balance, and sets thedateOpened to current date. The accessor and mutator functions for id and balance. A accessor method to return dateOpened. A method named withdraw that withdraws a specified amount from the account. A method named deposit that deposits a specified amount to the account. A method named toString() to return a string in following format:Account id: 10023Account opened:Balance: $1000.00Account.java# id : int# balance : double# dateOpened : Date+ Account()+ Account(id:int, balance:dounle)+ getId(): int+ getBalance(): double+ setId(id:int) : void+ setBalance(balance:double) : void+getDateOpened(): Date+ withdraw(amount:double) :void+ deposit(amount:double) : void+ toString(): stringSTAGE 2: (Derived classes of Account) In Stage 1, the Account class was created to model a bankaccount. An account has the properties account number, balance, and methods to deposit andwithdraw.Create two derived classes for checking and saving accounts.SATGE 2: (The Checking class) Design a subclass of Account called Checking.java that contains: A double data field named overdraftLimit. A checking account has an overdraft limit ($500) andacquires no interest. Define and override withdraw() methods. Define and override the toString() function to return a string in the following format:CheckingsAccount id: 1003Account opened:Balance: $5000.00NOTE: Checking account cannot be overdrawn more than overdraftLimit. Reset balance.Checkings.java# overdraftlimit : double // default is 500+ Checkings()+ Checkings(id:int, balance:double)+ withdraw(amount:double) : void+ toString():stringSATEG 3: (The Saving class) Design a subclass of Account called Saving.java that contains: A data filed named annualInterestRate. The accessor and mutator functions for annualInterestRate. A function named getMonthlyInterest() that returns the monthly interest. Define and override the toString() function to return a string in the following format:SavingsAccount id: 1002Account opened:Balance: 1000Interest Rate: 6%NOTE: Saving account cannot be overdrawn. Reset balanceSavings.cpp# annualInterestRate : double+ Savings()+Savings(id:int, balance:double,rate:double)+ getAnnualInterestRate(): double+ setAnnualIntersetRate(rate:double) : void+ getMonthlyInterest(): double+ withdraw(amount:double) : void+ toString(): string1) Implement the classes.2) Use MyBank.java driver program to test your classes.

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

Step: 3

blur-text-image

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 Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions

Question

Differentiate among sporadic, persistent, and predatory dumping.

Answered: 1 week ago