Question: For C++, please assist. Also, can you include a screenshot of code working and label the codes so I can easily understand? I am unsure
For C++, please assist. Also, can you include a screenshot of code working and label the codes so I can easily understand? I am unsure what I am doing wrong when doing it with the test file included in the code.



Code that I was trying to use with the test file included in the assignment.
bankAccount.cpp #include "bankAccount.h"
bankAccount::bankAccount() { }
bankAccount::bankAccount(string acctNum, double startBal) { accountNumber = acctNum; balance = startBal; }
bankAccount::~bankAccount() { }
double bankAccount::deposit(double depositAmt) { balance += depositAmt; return balance; }
string bankAccount::getAccountNumber() { return accountNumber; }
double bankAccount::getBalance() { return balance; }
void bankAccount::print() { cout
void bankAccount::setAccountNumber(string acctNum) { accountNumber = acctNum; }
double bankAccount::withdraw(double withdrawalAmt) { balance -= withdrawalAmt; return balance; }
bankAccount.h
#ifndef BANKACCOUNT_H #define BANKACCOUNT_H #include
class bankAccount { protected: string accountNumber; double balance;
public: bankAccount(); bankAccount(string acctNum, double startBal); ~bankAccount(); double deposit(double depositAmt); string getAccountNumber(); double getBalance(); void print(); void setAccountNumber(string acctNum); double withdraw(double withdrawalAmt); };
#endif // !BANKACCOUNT_H
checkingAccount.cpp
#include "checkingAccount.h"
checkingAccount::checkingAccount() { }
checkingAccount::checkingAccount(string acctNum, double startBal, double intRate, double minBalance, double srvCharge) { bankAccount::accountNumber = acctNum; bankAccount::balance = startBal; interestRate = intRate; minimumBalance = minBalance; serviceCharge = srvCharge; }
checkingAccount::~checkingAccount() { }
double checkingAccount::getInterestRate() { return interestRate; }
double checkingAccount::getMinimumBalance() { return minimumBalance; }
double checkingAccount::getServiceCharge() { return serviceCharge; }
// Multiplies balance times interest rate (as percentage) divided by 100, adds interest to balance, // and returns interest gained double checkingAccount::postInterest() { if (balance
void checkingAccount::print() { cout
void checkingAccount::setInterestRate(double intRate) { interestRate = intRate; }
void checkingAccount::setMinimumBalance(double minBalance) { minimumBalance = minBalance; }
void checkingAccount::setServiceCharge(double srvCharge) { serviceCharge = srvCharge; }
// returns true if balance is below minimum balance bool checkingAccount::verifyMinimumBalance() { bool balanceBelow = false;
if (bankAccount::balance
return balanceBelow; }
double checkingAccount::withdraw(double withdrawalAmt) { //check if enough balance if ((bankAccount::balance - withdrawalAmt)
void checkingAccount::writeCheck(string recipient, double checkAmount) { if ((balance - checkAmount)
checkingAccount.h
#ifndef CHECKINGACCOUNT_H #define CHECKINGACCOUNT_H #include "bankAccount.h" #include
class checkingAccount : public bankAccount { private: double interestRate; double minimumBalance; double serviceCharge; public: checkingAccount(); checkingAccount(string acctNum, double startBal, double intRate, double minBalance, double srvCharge); ~checkingAccount(); double getInterestRate(); double getMinimumBalance(); double getServiceCharge(); double postInterest(); void print(); void setInterestRate(double intRate); void setMinimumBalance(double minBalance); void setServiceCharge(double srvCharge); bool verifyMinimumBalance(); double withdraw(double withdrawalAmt); void writeCheck(string recipient, double checkAmount); };
#endif
savingsAccount.cpp
#include "savingsAccount.h"
savingsAccount::savingsAccount() { }
savingsAccount::savingsAccount(string acctNum, double startBal, double intRate) { accountNumber = acctNum; balance = startBal; interestRate = intRate; }
savingsAccount::~savingsAccount() { }
double savingsAccount::getInterestRate() { return interestRate; }
double savingsAccount::postInterest() { double interest = 0; interest = bankAccount::balance * (interestRate / 100); bankAccount::balance += interest;
return interest; }
void savingsAccount::print() { cout
void savingsAccount::setInterestRate(double intRate) { interestRate = intRate; }
double savingsAccount::withdraw(double withdrawalAmt) { //verify there's enough money in account if ((bankAccount::balance - withdrawalAmt)
savingsAccount.h
#ifndef SAVINGSACCOUNT_H #define SAVINGSACCOUNT_H #include
class savingsAccount : public bankAccount { private: double interestRate; public: savingsAccount(); savingsAccount(string acctNum, double startBal, double intRate); ~savingsAccount(); double getInterestRate(); double postInterest(); void print(); void setInterestRate(double intRate); double withdraw(double withdrawalAmt); };
#endif
bankAccount extended Create from scratch or modify week 1 bankAccount class The class should define and implement the following data and methods bankAccount Data accountNumber balance Methods setAccountNumber getAccountNumber getBalance withdraw deposit Constructor sets account number sets account balance class nt from base class bankAccount. The t class should define and implement the following data and methods checkingAccount ata Methods getMinimumBalance getInterestRate getServiceCharge minimumBalance serviceCharge setServiceCharge writeCheck withdraw structor sets account number sets account balance sets minimum balance set interest rate sets service charge amount postinterest takes the interest amount based off of the total balance and adds it to the balance (balance balance interestRate) writeCheck calls withdraw withdraw checks to make sure there is enough money in the account first and reports a warning if not. If there is enough money to make the withdraw, it then checks to see if the balance will go below the minimum amount after the withdraw. If so, it checks to see if the balance will go below zero after the withdraw and the service charge is applied. Should this occur an error is reported. If not, the balance is adjusted to reflect the withdraw and the service charge applied Derive class savingsAccount from base class bankAccount. The savingsAccount class should define and implement the following data and methods savingSAccount Methods getInterestRate ata withdraw postinterest structo sets account number sets account balance set interest rate TES Withdraw checks to make sure there is enough money before altering the balance. If not, a mes IS and the balance remains unchan Create a main program to test the class as follows. Use hard coded data (do not prompt the user for data, just make up values). Perform these steps in order: create 2 checking accounts and 2 savings accounts deposit money in each post interest in each print details of each write checks in the checking accounts withdraw from the savings accounts print details of each You may use the following main #include aostream> #include qomanp include "savingsAccounth" program to test your classes if you wish: using namespace std int main int accountNumber 1000; checkingAccount jackAccount(accountNumber+,1000); savingsAccount samirAccount(accountNumber+, 9300); savingsAccount ritaAccount(accountNumber+, 32); jackAccount.deposit(1000) lisaAccount.deposit(2300); samirAccount deposit(800); itaAccount.deposit(500); samirAccount postinterestO cout
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
