C++ Week 3

Get your Assignment in a Minimum of 3 hours

Our academic experts are ready and waiting to assist with any writing project you may have. From simple essay plans, through to full dissertations, you can guarantee we have a service perfectly matched to your needs.

Free Inquiry Order A Paper Now Cost Estimate

I need an explanation for this C Programming question to help me study.

Save your time - order a paper!

Get your paper written from scratch within the tight deadline. Our service is a reliable solution to all your troubles. Place an order on any task and we will take care of it. You won’t have to worry about the quality and deadlines

Order Paper Now

Create from scratch or modify week 2 program as follows.

bankAccountThe bankAccount class will be abstract in this assignment and will use virtual and pure virtual functions.

Data

accountNumber

name

balance

Methods

getAccountNumber

getBalance

getName

setName

deposit

withdraw (virtual)

print (virtual)

createMonthlyStatement (pure virtual)

Constructor:

  • sets account number
  • set account holder name
  • sets account balance

Note:

Print() – displays the account number and balance

Derive class checkingAccount from base class bankAccount. The checkingAccount class should define and implement the following data and methods:

checkingAccount

Data

interestRate

minimumBalance

serviceCharge

fee

Methods

getMinimumBalance

setMinimumBalance

getInterestRate

setInterestRate

getServiceCharge

setServiceCharge

postInterest

writeCheck

withdraw

print

createMonthlyStatement

Constructor:

  • sets account holder name
  • sets account number
  • sets account balance
  • sets minimum balance
  • set interest rate
  • sets service charge amount
  • sets amount of monthly fee

NOTES:

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 adjust to reflect the withdraw and the service charge applied.

createMonthlyStatement – this posts the interest (calls postInterest()) and deducts the monthly fee from the balance.

Print uses the base class print() and then also prints the interest rate.

Derive class savingsAccount from base class bankAccount. The savingsAccount class should define and implement the following data and methods:

savingsAccount

Data

interestRate

Methods

getInterestRate

setInterestRate

withdraw

postInterest

print

createMonthlyStatement

Constructor:

  • sets account holder name
  • sets account number
  • sets account balance
  • set interest rate

NOTES:

Withdraw checks to make sure there is enough money before altering the balance. If not, a warning message is printed and the balance remains unchanged.

Create monthly statement – this posts the interest to the account

Print uses the base class print() and then also prints the interest rarte.

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:

  • define an array to hold 6 bankAccount classes.
  • store 3 new checking accounts and 3 new savings accounts in the array
  • Print a “January Header”
  • for all 6 accounts, create the monthly statement then print the account info
  • print a February header
  • for all 6 accounts, create the monthly statement then print the account info
  • withdraw 500 for each account
  • print a match header
  • for all 6 accounts, create the monthly statement then print the account info

The following is an example of a main program you can choose to use which meets the above requirements:

#include <iostream>

#include <iomanip>

#include savingsAccount.h

#include checkingAccount.h

usingnamespacestd;

int main()

{

bankAccount *accountsList[6];

accountsList[0] = newcheckingAccount(“Bill”, 10200, 25000,100,0.012,10.00);

accountsList[1] = newcheckingAccount(“Bob”, 10210, 10000,100,0.0099,15.00);

accountsList[2] = newsavingsAccount(“Susan”, 90001, 20000,0.031);

accountsList[3] = newsavingsAccount(“Steve”, 90002, 50000,0.041);

accountsList[4] = newcheckingAccount(“Sally”, 10220, 4999,100,0.0079,20.00);

accountsList[5] = newsavingsAccount(Frad, 90003, 2000,0.011);

cout << “January:n————-“ << endl;

for (int i = 0; i < 6; i++)

{

accountsList[i]->createMonthlyStatement();

accountsList[i]->print();

cout << endl;

}

cout << nFebruary:n————-“ << endl;

for (int i = 0; i < 6; i++)

{

accountsList[i]->createMonthlyStatement();

accountsList[i]->print();

cout << endl;

}

for (int i = 0; i < 6; i++)

{

accountsList[i]->withdraw(500);

}

cout << nMarch:n————-“ << endl;

for (int i = 0; i < 6; i++)

{

accountsList[i]->createMonthlyStatement();

accountsList[i]->print();

cout << endl;

}

return0;

}

Output can look similar to this:

January:

————-

Interest Checking ACCT#: 10200 balance : $25290.00 Interest Rate = 1.20%

Interest Checking ACCT#: 10210 balance : $10089.00 Interest Rate = 0.99%

Savings ACCT#: 90001 balance : $20620.00 Interest Rate = 3.10%

Savings ACCT#: 90002 balance : $52050.00 Interest Rate = 4.10%

Interest Checking ACCT#: 10220 balance : $5028.49 Interest Rate = 0.79%

Savings ACCT#: 90003 balance : $2022.00 Interest Rate = 1.10%

February:

————-

Interest Checking ACCT#: 10200 balance : $25583.48 Interest Rate = 1.20%

Interest Checking ACCT#: 10210 balance : $10178.88 Interest Rate = 0.99%

Savings ACCT#: 90001 balance : $21259.22 Interest Rate = 3.10%

Savings ACCT#: 90002 balance : $54184.05 Interest Rate = 4.10%

Interest Checking ACCT#: 10220 balance : $5058.22 Interest Rate = 0.79%

Savings ACCT#: 90003 balance : $2044.24 Interest Rate = 1.10%

March:

————-

Interest Checking ACCT#: 10200 balance : $25374.48 Interest Rate = 1.20%

Interest Checking ACCT#: 10210 balance : $9764.70 Interest Rate = 0.99%

Savings ACCT#: 90001 balance : $21402.76 Interest Rate = 3.10%

Savings ACCT#: 90002 balance : $55885.10 Interest Rate = 4.10%

Interest Checking ACCT#: 10220 balance : $4584.23 Interest Rate = 0.79%

Savings ACCT#: 90003 balance : $1561.23 Interest Rate = 1.10%

Implementation Requirements

You will create seven files for this assignment:

  • bankAccount.h (base class definition)
  • bankAccount.cpp (base class implementation)
  • checkingAccount.h (checkingAccount definition)
  • checkingAccount.cpp (checkingAccount implementation)
  • savingsAccount.h (savingsAccount definition)
  • savingsAccount.cpp (savingsAccount implementation)
  • bankAccountTest.cpp (test file for your bankAccount class)

Submit source code, a screenshot with a time stamp of code execution, and a text file of the code. All code should include comments.

"Is this question part of your assignment? We Can Help!"

"Our Prices Start at $11.99. As Our First Client, Use Coupon Code GET15 to claim 15% Discount This Month!!"

Get Started