Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Bank Account extended for C++ Codes that was used in previous assignment Code 1 #includebankAccount.h using namespace std; int bankAccount::n = 0;//Initialize static member n

Bank Account extended for C++

image text in transcribed

image text in transcribed

image text in transcribed

Codes that was used in previous assignment

Code 1

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

Code 2

#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

Code 3

#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; ritaAccount.print0 jackAccount.writeCheck(250) lisaAccount.writeCheck(350); samirAccount.withdraw(120); ritaAccount withdraw(290); jackAccount.print0: lisaAccount.print0: samirAccount.printO: ritaAccount.print) return 0; Implementation Requirements You will create seven files for this assignment: bankAccount.h (base class definition) bank/' (xx)urtt.cpp (biatit;ck t; l"ipleriKTIiation) checkingAccount.h (checkingAccount definition) ickijcxxnini.cfx> (chkj/xxui irpkKi-aic) 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

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

More Books

Students also viewed these Databases questions

Question

What are your strengths and weaknesses?

Answered: 1 week ago

Question

Brief the importance of span of control and its concepts.

Answered: 1 week ago

Question

What is meant by decentralisation?

Answered: 1 week ago