Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using this create c++ consule: class Account { long id; double balance; double annualIntrest; public: Account(){ id=0; balance=0; annualIntrest=0; } public: Account(int v_id,double v_balance, double

using this create c++ consule:

class Account { long id; double balance; double annualIntrest; public: Account(){ id=0; balance=0; annualIntrest=0; } public: Account(int v_id,double v_balance, double v_annualIntrest){ id=v_id; balance=v_balance; annualIntrest=v_annualIntrest; } public: int getId(){ return id; } public: double getBalance(){ return balance; } public: double getAnnualIntrest(){ return annualIntrest; } public: double getMonthlyAnnualIntrest(){ return annualIntrest/12; } public: double getMonthlyIntrestRate(){ return (annualIntrest/12)*100; } public: double getMonthlyIntrest(){ return getMonthlyIntrestRate()*getBalance(); } public: void setId(int v_id){ id=v_id; } public: void setBalance(double v_balance){ balance=v_balance; } public: void setAnnualIntrest(double v_annualIntrest){ annualIntrest=v_annualIntrest; } public: bool withdraw(double amount){ if(balance

return false; } else{ balance=balance-amount; return true; } } public: void deposite(double amount){ balance=balance+amount; } };

Define 2 additional classes named CheckingAccount and SavingsAccount that will be subclasses of the Account class. The CheckingAccount class should define a data member to represent an overdraft limit and override the withdraw method in order to allow an overdraft. The SavingsAccount class should define a data member to represent a minimum balance. It should override the withdraw method to assess a $10 fee to the account if the account drops below the minimum balance. Add a toString method to the Account class and then override it in the subclasses. The toString method should return string that contains information about the account number and the balance. From main, create objects of type Account, CheckingAccount and SavingsAccount and then demonstrate the new functionality that the classes provide by depositing and withdrawing money from the accounts.

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

Demystifying Databases A Hands On Guide For Database Management

Authors: Shiva Sukula

1st Edition

8170005345, 978-8170005346

More Books

Students also viewed these Databases questions

Question

LPS Table Creation and KMP Algorithm Implementation in C++

Answered: 1 week ago