Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Copied is my previous code, I am struggling to implement the new code. Please assist. //main.cpp#include #include bankAccount.husing namespace std;// Initialize static member nextaccountnumber of

Copied is my previous code, I am struggling to implement the new code. Please assist.

//main.cpp#include #include "bankAccount.h"using namespace std;// Initialize static member "nextaccountnumber" of class bankAccountint bankAccount::nextaccountnumber = 1000;//Declare a constconst int CUSTOMER_COUNT = 10;//main functionint main(){//Declaring an array of 10 components of type bankAccount.bankAccount myaccounts[CUSTOMER_COUNT]; //getting customer information from userfor(int index = 0; index > balance; //get interest ratecout > interestrate;//creating object and adding it to arraymyaccounts[index] = bankAccount(holdername, accounttype, balance, interestrate);cin.ignore();}//Iterating the array and printing all the customer informationcout 

//bankAccount.cpp

//bankAccount.cpp#include "bankAccount.h"#include #include using namespace std;// Parameterized constructor to set account holder, account type, balance and interest ratebankAccount::bankAccount(string holdername, string type, double initialbalance, double rate){accountholder = holdername;accounttype = type;balance = initialbalance;interestrate = rate;accountnumber = nextaccountnumber;nextaccountnumber++;}// deposit function to add the amount to the balancevoid bankAccount::deposit(double amount) {//Adding the amount to current balancebalance += amount;}//withdraw function to withdraw amount from accountbool bankAccount::withdraw(double amount) {if(balance >= amount){balance -= amount;return true;}else{return false;}}// getInterest function to calculate interestdouble bankAccount::getInterest() {return balance * interestrate;}// updateBalance function to add interest amount to balancevoid bankAccount::updateBalance() {balance += getInterest();}// print function to display all account informationvoid bankAccount::print() {cout 

bankAccount.h

//bankAccount.h#ifndef BANKACCOUNT_H#define BANKACCOUNT_H#include using namespace std;class bankAccount {private: //Account holders name (string)string accountholder;//Account number (int)int accountnumber;//Account type (string, checking or savings)string accounttype;//Balance (double)double balance;//Interest rate (double, to be stored as a decimal value)double interestrate; public://Static member function to assign account numbersstatic int nextaccountnumber; //add money to accountvoid deposit(double);//take money out of accountbool withdraw(double);//balance times interest ratedouble getInterest();//adds interest amount to balancevoid updateBalance();//displays all account informationvoid print();//getters methodint getAccountNumber();string getAccountHolderName();string getAccountType();double getBalance();double getInterestRate(); //default constructorbankAccount(){}; //Parameterized constructorbankAccount(string holdername, string type, double bal, double rate); };#endif

Please see below instructions for programming exercise:

image text in transcribedimage text in transcribed
service charge applied. Derive class savingsAccount from base class bankAccount. The savingsAccount class should define and implement the following data and methods: savingsAccount Data Methods interestRate 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 eachYou 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)

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

Define differentiation and market positioning.

Answered: 1 week ago