Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

Please use the following instructions and make sure there are separate files. Also if possible show the program running. THIS IS USING C++ Problem Definition

Please use the following instructions and make sure there are separate files. Also if possible show the program running.

THIS IS USING C++

image text in transcribed

Problem Definition Create an inheritance hierarchy containing base class Account and derived class Savings-Account. Base class Account should include one data member of type double to represent the account balance. The class should provide a constructor that receives an initial balance and uses it to initialize the data member. The class should provide three member functions. Member function credit should add an amount to the current balance. Member function debit should withdraw money from the Account and ensure that the debit amount does not exceed the Account's balance. Member function getBalance should return the current balance. Derived class SavingsAccount should inherit the functionality of an Account, but also include a data member of type double indicating the interest rate (percentage) assigned to the Account. SavingsAccount's constructor should receive the initial balance, as well as an initial value for the SavingsAccount's interest rate. SavingsAccount should provide a public member function calculatelnterest that returns a double indicating the amount of interest earned by an account. Member function calculatelnterest should determine this amount by multiplying the interest rate by the account balance. [Note: SavingsAccount should inherit member functions credit and debit as is without redefining them.] Part 1: Class Definition Implement the class definition for class Account and SavingsAccount in the files called Account,h and SavingsAccount.h. The class definition should contain only the prototypes of the member functions and double members Part 2.1: Member-function definition Implement the member-function definition of classes in the files called vingsAC This.cpp file contains the actual implementation of the member functions of the two classes. Part 2.2: Test program Write a program that tests your class Account and SavingAcounts. Call your file testAccount.cpp. This program should: 1. Instantiate an object of class SavingAccounts and Accounts. 2. Add some credit to both objects 3. Add some credit to both objects 4. Withdraw some amount for both objects 5. Print the interest for the saving account object. 6. Print the current balance of each account

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

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students explore these related Databases questions

Question

How wide are Salary Structure Ranges?

Answered: 3 weeks ago