Question
Write a program to process bank accounts. Create a base class named Account and two derived classes named Savings and Checking. In the base class,
Write a program to process bank accounts. Create a base class named Account and two derived classes named Savings and Checking. In the base class, use an int AccountNum and a double balance for data members. Also, create an overloaded operator+= function to do deposit and an overloaded operator?= function to do withdraw. The printBalance function is created to print both savings and checking accounts. The account number of new account is automatically generated by the program beginning at account number one.
Hint for the test program:
int main( )
{
vector checking(50) ;
vector savings(50);
int accNumS = 0, accNumC = 0;
double bal = 0, amt = 0;
...
case 1:
cout
cin >> bal;
checking[accNumC] = new Checking(accNumC+1,bal);
accNumC++;
break;
...
case 3:
cout
cin >> acct;
cout
cin >> amt ;
(*checking[acct-1]) += amt;
break;
Problem Requirement
a) You must use a separate .h and .cpp files for each class.
b) You must use a separate file for the Testing program.
c) Your program must produce the prompt and the output the same as given.
d) The balances should be displayed with 2 decimal places.
Step 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