Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Version:1.0 StartHTML:000000234 EndHTML:000121485 StartFragment:000078853 EndFragment:000121447 StartSelection:000078853 EndSelection:000121436 SourceURL:https://content.grantham.edu/academics/LPF_CS285/CS285W2Assignment.html bankAccount extended Create from scratch or modify week 1 bankAccount class. The class should define and implement

Version:1.0 StartHTML:000000234 EndHTML:000121485 StartFragment:000078853 EndFragment:000121447 StartSelection:000078853 EndSelection:000121436 SourceURL:https://content.grantham.edu/academics/LPF_CS285/CS285W2Assignment.html

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

print

Constructor:

  • sets account number
  • sets account 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

Methods

getMinimumBalance

setMinimumBalance

getInterestRate

setInterestRate

getServiceCharge

setServiceCharge

postInterest

writeCheck

withdraw

print

Constructor:

  • sets account number
  • sets account balance
  • sets minimum balance
  • set interest rate
  • sets service charge amount

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 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

Data

interestRate

Methods

getInterestRate

setInterestRate

withdraw

postInterest

print

Constructor:

  • 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 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:

  1. create 2 checking accounts and 2 savings accounts
  2. deposit money in each
  3. post interest in each
  4. print details of each
  5. write checks in the checking accounts
  6. withdraw from the savings accounts
  7. print details of each

You may use the following main program to test your classes if you wish:

#include

#include

#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;

}

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 commen

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

Oracle Autonomous Database In Enterprise Architecture

Authors: Bal Mukund Sharma, Krishnakumar KM, Rashmi Panda

1st Edition

1801072248, 978-1801072243

Students also viewed these Databases questions