Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Previous build used: #includebankAccount.h using namespace std; int bankAccount::n = 0;//Initialize static member n //Method to perform deposit void bankAccount::deposit(double amount) { accountBalance += amount;//Deposit

image text in transcribed

image text in transcribed

image text in transcribed

Previous build used:

#include"bankAccount.h"

using namespace std;

int bankAccount::n = 0;//Initialize static member n

//Method to perform deposit void bankAccount::deposit(double amount) { accountBalance += amount;//Deposit }

//Method to perform withdrawl void bankAccount::withdraw(double amount) { if (accountBalance - amount

//Method to return balance time interest double bankAccount::getInterest() { return (accountBalance * interestRate); }

//Method to add interest to balance void bankAccount::updateBalance() { accountBalance += getInterest(); }

//Method to print all account information void bankAccount::print() { cout

//Method to get account number int bankAccount::getAccountNumber() { return accountNumber; }

//Method to get account holder name string bankAccount::getAccountHolderName() { return accountHolderName; }

//Method to get account type string bankAccount::getAccountType() { return accountType; }

//Method to get balance double bankAccount::getBalance() { return accountBalance; }

//Method to get interest rate double bankAccount::getInterestRate() { return interestRate; }

New Code start

#ifndef BANK_ACCOUNT_H #define BANK_ACCOUNT_H

#include #include

using namespace std;

class bankAccount { private: string accountHolderName;//Account holder name int accountNumber;//Account number string accountType;//Account type(savings or checking) double accountBalance;//Account balance double interestRate;//Interest rate static int n; public: //Constructor bankAccount(string name, string type, double balance, double rate) : accountHolderName(name), accountType(type), accountBalance(balance), interestRate(rate) { n++; accountNumber = 10000 + n;//Assign account number }

void deposit(double amount); void withdraw(double amount); double getInterest(); void updateBalance(); void print(); int getAccountNumber(); string getAccountHolderName(); string getAccountType(); double getBalance(); double getInterestRate(); };

#endif

New code start

#include #include "bankAccount.h"

using namespace std;

int main() { bankAccount acc[10] = { { "Kailani", "Savings", 45, 1.2 }, { "Shay", "Savings", 960, 1.2 }, { "Kimber", "Checking", 985, 1.5 }, { "Josh", "Checking", 645, 1.5 }, { "Ken", "Savings", 820, 1.2 }, { "Derek", "Checking", 996, 1.5 }, { "Holly", "Savings", 675, 1.5 }, { "Jess", "Savings", 250, 1.2 }, { "Jet", "Checking", 380, 1.2 }, { "Ben", "Savings", 52, 1.2 }, };

for (int i = 0; i bankAccount extended Create from scratch or modify week 1 bankAccount class. bankAccount Data accountNumber balance The class should define and implement the following data and methods: Methods setAccountNumber getAccountNumber getBalance withdraw 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 Methods getMinimumBalance setMinimumBalance getInterestRate etInterestRate getServiceCharge setServiceCharge postInterest writeCheck withdraw minimumBalance serviceCharge 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 ccount savin Data interestRate Methods getInterestRate setInterestRate withdraw 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). 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 program to test your classes if you wish: include #includeciomanip> #include "savings-Account.h" include "checkingAccount.h" using namespace std; int mainO Perform these steps in order: int accountNumber = 1000; checkingAccount jackAccount accountNumber++,1000); checking Account lisaAccount accountNumber+, 450); savingsAccount samirAccount(accountNumber++, 9300); savingsAccount ritaAccount(accountNumber++, 32); ackAccount.deposit(1000); lisaAccount.deposit(2300); samirAccount.deposit(S00); ritaAccount.deposit(500); jackAccount postlnterest0 lisaAccount.postInter samirAccount.postInterestO: ritaAccount.postInterest0: jackAccount print0; lisaAccount print0; samirAccountprint0; ritaAccount printo

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

Step: 3

blur-text-image

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

Databases DeMYSTiFieD

Authors: Andy Oppel

2nd Edition

0071747990, 978-0071747998

More Books

Students also viewed these Databases questions