Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Here is what I have so far for my code. #include <iostream> #include <iomanip> #

ID: 3628276 • Letter: H

Question

Here is what I have so far for my code.


#include <iostream>
#include <iomanip>
#include "savingsAccount.h"
#include "checkingAccount.h"

using namespace std;

int main()
{
     int accountNumber = 1000;

     checkingAccount jackAccount(accountNumber++,1000);
     checkingAccount lisaAccount(accountNumber++, 450);
     savingsAccount samirAccount(accountNumber++, 9300);
     savingsAccount ritaAccount(accountNumber++, 32);

     jackAccount.deposit(1000);
     lisaAccount.deposit(2300);
     samirAccount.deposit(800);
     ritaAccount.deposit(500);

     jackAccount.postInterest();
     lisaAccount.postInterest();
     samirAccount.postInterest();
     ritaAccount.postInterest();

     cout << "***********************************" << endl;
     jackAccount.print();
     lisaAccount.print();
     samirAccount.print();
     ritaAccount.print();
     cout << "***********************************" << endl << endl;

     jackAccount.writeCheck(250);
     lisaAccount.writeCheck(350);
     samirAccount.withdraw(120);
     ritaAccount.withdraw(290);

     cout << "********After withdrawals ***************" << endl;
     jackAccount.print();
     lisaAccount.print();
     samirAccount.print();
     ritaAccount.print();
     cout << "***********************************" << endl << endl;

     return 0;
}

Here is there question:

14 a. Define the class bankAccount to store a bank customer's account number and balance. Suppose that account number is of type int, and balance is of type double. Your class should, at least, provide the following options: set the number, retreive the account number, retreive the balance, deposit and withdraw money, and print account information. Add appropriate constructors.

b. Every Bank offers a checking account. Derive the class checkingAccount from the class bankAccount (designed in part (a)). This class inherits members to store the account number and the balance from the base class. A customer with a checking account typically receives interest, maintains a minimum balance, and pays service charges if the balance falls below the minimum balance. Add member variables to store this additional information. In addition to the operations inherited from hte base class, this class should provide the following operations: set interest rate, retreive interest rate, set minimum balance, retrieve minimum balance, set service charges, retrieve service charges, post interest, verify if the balance is less than the minimum balance, write a check, withdraw (override the method of the base class), and print account information. Add appropriate constructors.

c. Every bank offers a savings account. Derive the class savingsAccount from the class bankAccount (design in part (a)). This class inherits members to store the account number and the balance from the base class. A customer with a savings account typically receives interest, make deposits, and withdraw money. In addition to the operations inherited from the base class, this class shoudl provide the following operations: set interest rate, retrieve interest rate, post interest, withdraw (override the method of the base class), and print account information. Add appropriate constructors.

b. Write a program to test your classes designed in part (b) and (c).

Explanation / Answer

please rate - thanks

#include <iostream>
#include <iomanip>
using namespace std;
class bankAccount
{public:
    bankAccount(int,double);   
    void setAccNum(int);
    int getAccNum();
    double getBalance();
    void withdraw(double);
    void deposit(double);
    void print();
protected:
    int accNum;
    double balance;
};
class savingsAccount: public bankAccount
{public:
    savingsAccount(int,double);
    void setRate(double);  
    double getRate();
    void withdraw(double);
    void postInterest();
    void savingsAccount::print();
protected:
    double rate;
};
class checkingAccount: public bankAccount
{
public:
    checkingAccount(int accNum,double bal);  
    double getMinBal();
    double getRate();
    double getFee();
    void setMinBal(double);   
    void setRate(double);   
    void setFee(double);
    void postInterest();
    bool checkMinBal(double);
    void checkingAccount::writeCheck(double);
    void withdraw(double);
    void print();
protected:
    double rate,minBal,fee;
};
bankAccount::bankAccount(int n,double b)
{accNum=n;
balance=b;
}
void bankAccount::setAccNum(int a)
{accNum=a;
}
int bankAccount::getAccNum()
{return accNum;
}
double bankAccount::getBalance()
{return balance;
}
void bankAccount::withdraw(double a)
{balance-=a;
}
void bankAccount::deposit(double a)
{balance+=a;
}
void bankAccount::print()
{cout<<accNum<<"Balance: $"<<setprecision(2)<<fixed<<balance<<endl;
}
checkingAccount::checkingAccount(int n,double b):bankAccount(n,b)
{setRate(.04);
setMinBal(500);
setFee(20);
}
double checkingAccount::getMinBal()
{return minBal;
}
double checkingAccount::getRate()
{return rate;
}
double checkingAccount::getFee()
{return fee;
}
void checkingAccount::setMinBal(double m)
{minBal=m;
}
void checkingAccount::setRate(double r)
{rate=r;
}
void checkingAccount::setFee(double f)
{fee=f;
}
void checkingAccount::postInterest()
{balance+=(balance*rate);
}
bool checkingAccount::checkMinBal(double a)
{if(balance-a>=minBal)
       return true;
else
       return false;
}
void checkingAccount::writeCheck(double a)
{withdraw(a);
}
void checkingAccount::withdraw(double a)
{if(balance-a<0)
     cout<<"insufficient funds for $"<<a<<" withdrawal ";
else if(balance-a<minBal)
     if(balance-a-fee<minBal)
        cout<<"insufficient funds for withdrawal + fees, since balance will be below minimum ";
     else
        {cout<<"balance below minimum. $"<<fee<<" fee charged ";
         balance-=(a+fee);
        }
else
    balance-=a;
}
void checkingAccount::print()
{cout<<"Interest Checking ACCT#: "<<getAccNum()
     <<" Balance: $"<<setprecision(2)<<fixed<<getBalance()<<endl;
}
savingsAccount::savingsAccount(int n,double b):bankAccount(n,b)
{setRate(.06);
}
double savingsAccount::getRate()
{return rate;
}
void savingsAccount::setRate(double r)
{rate=r;
}
void savingsAccount::withdraw(double a)
{if(balance-a<0)
   cout<<"insufficient funds for $"<<setprecision(2)<<fixed<<" withdrawal ";
else
balance-=a;
}
void savingsAccount::postInterest()
{balance+=(balance*rate);
}
void savingsAccount::print()
{cout<<"Savings ACCT#: "<<getAccNum()
      <<" Balance: $"<<setprecision(2)<<fixed<<getBalance()<<endl;
}
int main()

{    

int accountNumber = 1000;

checkingAccount jackAccount(accountNumber++,1000);  

checkingAccount lisaAccount(accountNumber++, 450);  

savingsAccount samirAccount(accountNumber++, 9300);    

savingsAccount ritaAccount(accountNumber++, 32);



jackAccount.deposit(1000);  

lisaAccount.deposit(2300);    

samirAccount.deposit(800);    

ritaAccount.deposit(500);



jackAccount.postInterest();  

lisaAccount.postInterest();

samirAccount.postInterest();  

ritaAccount.postInterest();



     cout << "***********************************" << endl;    

jackAccount.print();    

lisaAccount.print();  

samirAccount.print();

ritaAccount.print();    



cout << "***********************************" << endl << endl;

jackAccount.writeCheck(250);  

lisaAccount.writeCheck(350);    

samirAccount.withdraw(120);    

ritaAccount.withdraw(290);


cout << "********After withdrawals ***************" << endl;  

jackAccount.print();  

lisaAccount.print();  

samirAccount.print();  

ritaAccount.print();  

cout << "***********************************" << endl << endl;

return 0;
}