Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include #include using namespace std; string user; string pass; string Option1; void food_list () { cout < < ; cout < < Choose

#include #include #include

using namespace std;

string user; string pass; string Option1;

void food_list () { cout << " "; cout << "Choose the option below : "; cout << " "; cout << "A - Cheezy grill chicken , Mix salad, Seafood salad (special promo)-RM62.00 "; cout << "B - Bolognese,carbonara,auglio olio, Mushroom Soup-RM26.70 "; cout << "C - kaya,peanut butter,garlic bread-RM10.40 "; cout << "D - French fries,chicken nuggets,sausage-RM21.80 "; cout << " "; cout << "Option : "; cin >> Option1;

return; } void seat_table () { cout << " "; cout << "Choose the option below : "; cout << " "; cout << "code1 - 8 seats, 4 tables"; cout << "code2 - 6 seats, 5 tables"; cout << "code3 - 5 seats, 6 tables"; return; } void purchase_payment_method () { cout << " "; cout << "Choose the option below : "; cout << " "; cout << "Purchase option "; cout << "Eat takeaway "; cout << "Payment option "; cout << "cash debit card /credit card "; return; } void Receipt_payment () { cout << " "; cout << "Choose the option below : "; cout << " "; cout << "Code \t\t List food order \t\t Price(RM)\\t\t Total Amount "; cout << "A\t\tCheezy grill chicken Mix salad, seafood salad(special promo)\t\tRM62.00 "; cout << "C\t\t kaya, peanut butter, garlic bread\t\tRM10.40\t\tRM99.10 "; return; }

void Register() { cout << "----Create new account---- "; cout << " "; ifstream file; ofstream newuser; string username, password, passwordconfirm; file.open("users.txt", ios::app); newuser.open("users.txt", ios::app); bool uservalid=false; while (!uservalid) { cout << "Enter new username : "; cin >> username; cout << "Enter new password : "; cin >> password; cout << "Confirm new password : "; cin >> passwordconfirm ; int m=0; int k=0; while (file >> user >> pass) { m++; if (username!=user) k++; } if (m==k && password == passwordconfirm) uservalid = true; else if (m!=k) cout << "There is already a user with this username. " << endl; else cout << "The password given do not match. " << endl; } newuser << username << " " << password << endl;; file.close(); newuser.close(); cout << " "; cout << "****SUCCESSFULLY REGISTERED****" << endl; cout << " "; }

int LoginCheck (string user, string pass) { ifstream file; string username, password; int n=0; file.open("users.txt"); if (file.is_open()) { while (!file.eof()) { file >> username >> password; n++; if (user==username && pass==password) return n; } } else { cout << "file not open" << endl; } return 0;

}

void NotUser() { int option1; cout << "Choose the option : "; cout << " "; cout << "1. MENU 2. EXIT" ; cout << " "; cout << "Option : "; cin >> option1; if (option1==1) { while (true) { cout << "Enter your choice . "; cout << "1\t List of food with price. "; cout << "2\t Number of seats and tables. "; cout << "3\t Purchase option and payment method. "; cout << "4\t Receipt payment. "; int ch; cin >>ch; switch (ch) { case 1: food_list (); break; case 2: seat_table (); break; case 3: purchase_payment_method (); break; case 4: Receipt_payment (); break; } } } else if (option1 == 2) { exit(0); } }

void FirstPage() { ifstream userfile; userfile.open("users.txt"); int loginattempts = 0; while (LoginCheck(user, pass)==0) { int option1; loginattempts++; cout<<"Enter username : "; cin>>user; cout<<"Enter password : "; cin >> pass; if (LoginCheck(user, pass)!=0) { cout<<"Choose the option : "; cout<<" "; cout <<"1. Menu 2. EXIT"; cout<<" "; cout <<"Option : "; cin>>option1; if (option1==1) { while (true) { cout << "Enter your choice . "; cout << "1\t List of food with price. "; cout << "2\t Number of seats and tables. "; cout << "3\t Purchase option and payment method. "; cout << "4\t Receipt payment. "; int ch; cin >>ch; switch (ch) { case 1: food_list (); break; case 2: seat_table (); break; case 3: purchase_payment_method (); break; case 4: Receipt_payment (); break; } } } else if(option1==2) { exit(0); } } else { cout <<"Invalid username or password"<

int main() { int loginattempts = 0; ifstream userfile; userfile.open("users.txt"); string userset, passset; if (!userfile.is_open()) { cout << "file not found" << endl; } else { cout << "~~~~ W E L C O M E ~~~~ "; cout << "Thank you for choosing our system "; cout << "Please choose the option below : "; cout <<" "; cout << "1. User 2. Not User 3. Register "<>option; cout << " "; if(option==1) { FirstPage(); } else if(option == 2) { NotUser(); } else if (option == 3) { Register(); cout << "Choose the option below : "; cout << " "; cout << "1. User 2. Not User 3. Register "<>option; cout << " "; if(option==1) { while (LoginCheck(user, pass)==0) { int option1; loginattempts++; cout<<"Enter username : "; cin>>user; cout<<"Enter password : "; cin >> pass; cout << " "; if (LoginCheck(user, pass)!=0) { cout<<"Choose the option : "; cout<<" "; cout <<"1. Menu 2. EXIT "; cout<<" "; cout <<"Option : "; cin>>option1; cout<<" "; if (option1==1) { while (true) { cout << "Enter your choice . "; cout << " "; cout << "1\t List of food with price. "; cout << "2\t Number of seats and tables. "; cout << "3\t Purchase option and payment method. "; cout << "4\t Receipt payment. "; int ch; cin >>ch; switch (ch) { case 1: food_list (); break; case 2: seat_table (); break; case 3: purchase_payment_method (); break; case 4: Receipt_payment (); break; } } } else if(option1==2) { exit(0); } } else { cout <<"Invalid username or password"<

} } int a; cin>>a; //this has no purpose other than stopping the program closing automatically return 0; }

Design of Application System Draw flowcharts depicting the steps involved in each menu choice of following programs...

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 Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

More Books

Students also viewed these Databases questions

Question

Find the derivative of y= cos cos (x + 2x)

Answered: 1 week ago

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago