Question: Write a program that uses a structure to store the information about a customer account: Name, Address, Account number, and Account balance. The program uses

Write a program that uses a structure to store the information about a customer account: Name, Address, Account number, and Account balance. The program uses an array of the structures with the size of 50. The program should let the user enter data into the array, change the contents of some members, (like change address, update account balance after deposit or withdraw) and display all the data stored in the array. The program should have a menu-driven user interface. The program needs a search function (by name or account number) to find the customer account in order to display the account information and change the contents. The program needs an input validation for the account balance, deposit amount, and withdraw amount. The example for the menu:

Add new customer account

Display the information for all customers

Find a customer account

Quit

In menu 3, there is a sub-menu like below:

Display the account information

Change the address of a customer

Deposit

Withdraw

Quit

i need to add this to my pevious program \/\/\/\/

#include #include #include using namespace std; #define size 20

struct customer { string name; string address; int account; double balance; }; void menu() { cout<<"\t 1. Add new customer account "<

{ cout<<" Enter the name of the customer : "; cin>>c[i].name; cout<<"Enter the account number of the customer : "; cin>>c[i].account; cout<<"Enter the balance : "; cin>>c[i].balance; cout<<"Enter the address of the customer : "; getline(cin,c[i].address);

} void printAll(struct customer *c ,int n)

{ if(n==0) { cout<<"There are no record.Try again"<

}

for(int i=0;i

{ if(n==0)

{ cout<<"There are no record. Try again"<

cin>>choice; int index=-1; if(choice==1) { int number; cout<<"Enter the account number :"; cin>>number; for(int i=0;i

if(c[i].account==number) { index=i; } }

} else {

cout<<" Invalid "<

if(index>0) { cout<<"Name :"<

{ cout<<"\tCustomer not found"<

int main() { int choice; int count=0; customer customerArray[size]; while(true) { menu(); cin>>choice; if(choice==1) { addCustomer(customerArray,count); count++; } else if(choice==2) { printAll(customerArray,count); } else if(choice==3) { search(customerArray,count); } else if(choice==4) { break; } else { cout<<"Ivalid choice. Try again."<

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!