Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Instructions Open the bank account pdf file on the homepage of this course (The following pictures are from the bank account pdf). Type the

C++

Instructions

Open the bank account pdf file on the homepage of this course (The following pictures are from the bank account pdf). Type the contents into notepad. Compile the implementation file. Compile the program. Please pay attention to what is happening in each section as you create the code. Create the files from the pdf. You are only copying the code, but attempting to pay attention to the task at hand to help in your understanding of classes.

image text in transcribedimage text in transcribedimage text in transcribed

//Main program

#include

#include

#include "bankAccount.h"

using namespace std;

void menu();

void subMenu();

int search(bankAccount list[], int length, int acctNum)

void addCustomer(bankAccount list[], int& length);

void processCustomer(bankAccount list[], int length, int acctNum);

void printCustomersData(bankAccount list[], int length);

int main()

{

bankAccount customersList[10];

int choice;

int numOfCustomer = 0;

int acctNumber;

char discard;

cout

menu();

cin >> choice;

cin.get(discard);

cout

while (choice != 9)

{

switch(choice)

{

case 1:

if (numOfCustomer

addCustomer(customersList, numOfCustomer);

else

cout

break;

case 2:

cout

cin >> acctNumber;

cout

processCustomer(customersList, numOfCustomer, acctNumber);

break;

case 3:

printCustomersData(customersList, numOfCustomer);

break;

default:

cout

}

menu();

cin >> choice;

cin.get(discard);

cout

}

return 0;

}

void menu()

{

cout

cout

cout

cout

}

void subMenu()

{

cout

cout

cout

cout

}

int search(bankAccount list[], int length, int acctNum)

{

for (int i = 0; i

if (list[i].getAccountNumber() == acctNum)

return 1;

return -1;

}

void addCustomer(bankAccount list[], int& length)

{

string name;

string acctType;

double deposit;

double interestRate;

if (length

{

cout

getline(cin, name);

cout

cout

cin >> acctType;

cout

cout

cin >> deposit;

cout

cout

cin >> interestRate;

cout

list[length++].setdata(name, acctType, deposit, interestRate);

}

else

cout

}

void processorCustomer(bankAccount list[], int length, int acctNum)

{

int index;

double amount;

index = search(list, length, acctNum);

if (index != -1)

{

subMenu();

int selection;

cin >> selection;

cout

while (selection != 9)

{

switch (selection)

{

case 1:

cout

cin >> amount;

cout

list[index].deposit(amount);

break;

case 2:

cout

cin >> amount;

cout

list[index].withdraw(amount);

break;

case 3:

list[index].print();

break;

default:

cout

}

subMenu();

cin >> selection;

cout

}

}

else

cout

}

void printCustomersData(bankAccount list[], int length)

{

for (int i = 0; i

{

list[i].print();

cout

}

}

bankAccount #include #include using namespace std; class bankAccount { public: void setdata(string name, string accType, double bal, double intRate); void deposit(double ant); void withdraw(double amt); double getInterest(); void updateBalance(); void print() const; int getAccount Number() const; string getAccountHolderName() const; string getAccountType() const; double getBalance() const; double getInterestRate() const; bankAccount(string name - ", string acc Type - double bal - 0.0, double intRate = 0.0); private: static int num; string accountHolderName; string accountType; int account Number; double balance; double interestRate; }; Page 1 bankAccount Imp #include #include "bankAccount.h" #include using namespace std; int bankAccount:: num = 100; void bankAccount::setdata(string name, string accType, double bal, double intRate) { accountHolderName = name; accountType accType; ; account Number = num; num = num + 100; balance = bal; interestRate - intRate / 100; } void bankAccount::deposit(double amt) { balance = balance + amt; } void bankAccount::updateBalance() { balance = balance + balance interestRate; } double bankAccount::getInterest() { return balance * interestRate; } void bankAccount::withdraw(double amt) { cout #include using namespace std; class bankAccount { public: void setdata(string name, string accType, double bal, double intRate); void deposit(double ant); void withdraw(double amt); double getInterest(); void updateBalance(); void print() const; int getAccount Number() const; string getAccountHolderName() const; string getAccountType() const; double getBalance() const; double getInterestRate() const; bankAccount(string name - ", string acc Type - double bal - 0.0, double intRate = 0.0); private: static int num; string accountHolderName; string accountType; int account Number; double balance; double interestRate; }; Page 1 bankAccount Imp #include #include "bankAccount.h" #include using namespace std; int bankAccount:: num = 100; void bankAccount::setdata(string name, string accType, double bal, double intRate) { accountHolderName = name; accountType accType; ; account Number = num; num = num + 100; balance = bal; interestRate - intRate / 100; } void bankAccount::deposit(double amt) { balance = balance + amt; } void bankAccount::updateBalance() { balance = balance + balance interestRate; } double bankAccount::getInterest() { return balance * interestRate; } void bankAccount::withdraw(double amt) { cout

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

Database Systems Introduction To Databases And Data Warehouses

Authors: Nenad Jukic, Susan Vrbsky, Svetlozar Nestorov

1st Edition

1943153191, 978-1943153190

Students also viewed these Databases questions