Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

LIKE THE EXAMPLE GIVEN ABOVE MAKE A PROPER FLOWCHART FOR THE FOLLOWING C++ CODE: #include #include #include #include using namespace std; //const int nor =

image text in transcribedimage text in transcribedimage text in transcribed

LIKE THE EXAMPLE GIVEN ABOVE MAKE A PROPER FLOWCHART FOR THE FOLLOWING C++ CODE:

#include #include #include #include using namespace std;

//const int nor = 50; int readfromfile(char name[][30], int phone[], int room[], int days[], int price[]); void addrecord(); void updaterecord(char name[][30], int phone[], int room[], int days[], int price[], int bil); void deleterecord(char name[][30], int phone[], int room[], int days[], int price[], int bil); int calculateprice(int room, int days); void display();

int main() { char name[50][30]; int phone[50], room[50], price[50], days[50]; char w = '1'; cout > w; system("CLS"); if (w == '1') { int i = 0;

while (i == 0) { cout

cout > i;

if (i == 1) { char LoopAgain = 'Y'; while (LoopAgain == 'Y') { system("CLS"); addrecord(); cout > LoopAgain;

} if (LoopAgain == 'N') { i = 0; system("CLS"); } }

if (i == 2) { char LoopAgain = 'Y'; while (LoopAgain == 'Y') { system("CLS"); int bil = readfromfile(name, phone, room, days, price); updaterecord(name, phone, room, days, price, bil); cout > LoopAgain; } if (LoopAgain == 'N') { i = 0; system("CLS"); } }

if (i == 3) { char LoopAgain = 'Y'; while (LoopAgain == 'Y') { system("CLS"); int bil = readfromfile(name, phone, room, days, price); deleterecord(name, phone, room, days, price, bil); cout > LoopAgain; } if (LoopAgain == 'N') { i = 0; system("CLS"); } }

if (i == 4) { system("CLS"); display(); i = 0; system("pause"); system("CLS"); } } } else cout

}

int readfromfile(char name[][30], int phone[], int room[], int days[], int price[]) { ifstream theFile("record.txt", ios::in); int bil = 0;

while (theFile >> name[bil] >> phone[bil] >> room[bil] >> days[bil] >> price[bil]) { bil++; } theFile.close(); return bil; }

void addrecord() { char name[30]; int phone, room, price, days;

cout > name; cout > phone; cout > room; cout > days; price = calculateprice(room, days);

ofstream theFile("record.txt", ios::app); theFile

void updaterecord(char name[][30], int phone[], int room[], int days[], int price[], int bil) { int change, i;

display(); cout > i; i = i - 1; cout > change;

if (change == 1) { cout > phone[i]; } else if (change == 2) { cout > room[i]; } else if (change == 3) { cout > days[i]; }

price[i] = calculateprice(room[i], days[i]);

ofstream theFile("record2.txt", ios::out); for (int i = 0; i

remove("record.txt");

rename("record2.txt", "record.txt"); }

void deleterecord(char name[][30], int phone[], int room[], int days[], int price[], int bil) { int num; display(); cout > num; num = num - 1;

ofstream theFile("record2.txt", ios::out); for (int i = 0; i

remove("record.txt");

rename("record2.txt", "record.txt"); }

int calculateprice(int room, int days) { int price; price = room * 120; price = price * days; return price; }

void display() { string name; int no = 1, phone, room, days, price; cout > name >> phone >> room >> days >> price) { cout

}

Start: Creating bank account: Our Customer Start Display a menu to select which operation user wish to use. int Declare array bool acc_created, string student_name, int account_type, double starting_balance, account_since_established, double deposit, double withdrawal, each with size 50 and all entries initialized to zero FALSE TRUE stad startina Display Menu End Prompt user to enter an integer choice_of_opera tion Switch Ichoice_of_operation Carreto startina 200 E Saviour created tabet altre student_statal de starting balance staletastatinai 1] 11.cut since et Create Customer Bank Account Checking Balance Deposit Withdrawal Puedes starting 2000 End Checking Balance: Deposit Checking Balance Ask user enter student number Prompt user to enter student num Read student number Read student number TRUE FALSE TRUE FALSE Prompt user to enter deposit Boolstudent_number Bookstudent_number Display an error message: "Account does not exist." Display an error message: Account does not exist. Calculate Account Balance: starting_balance pow ((1+ interest rate), account_since established) + deposit withdrawal Add deposit_ant to deposit student_num=11 Display a message Account Balance is"

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_2

Step: 3

blur-text-image_3

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

Identify the various influence tactics used in organizations;

Answered: 1 week ago

Question

a valuing of personal and psychological privacy;

Answered: 1 week ago