SuperTutor

(15)

$15/per page/Negotiable

About SuperTutor

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Business & Finance See all
Accounting,Business & Finance,Economics,Engineering,HR Management,Math Hide all
Teaching Since: Apr 2017
Last Sign in: 327 Weeks Ago, 5 Days Ago
Questions Answered: 12843
Tutorials Posted: 12834

Education

  • MBA, Ph.D in Management
    Harvard university
    Feb-1997 - Aug-2003

Experience

  • Professor
    Strayer University
    Jan-2007 - Present

Category > Programming Posted 10 Jul 2017 My Price 6.00

ability to save data

Add the ability to save data to disk in one or more files. The menu(s) should give the user the option to save or retrieve data. #include <iostream> using namespace std; int getChoice() {
int choice;
//validate user input in a loop
while(true) {
cin >> choice;
if(choice < 1 || choice > 2) {
cout << "Menu" << endl;
cout << "1. Check movies, their time and gate\n2. Exit\n";
} else {
break;
}
}
return choice;
} int getGateNo() { int gateNo;
bool valid = false;
int gateNos[3] = {1, 2, 3};
while(!valid) {
cout << endl <<"Please enter the Gate number : ";
cin >> gateNo;
for(int i = 0; i < 3; i++) {
if(gateNos[i] == gateNo) {
valid = true;
break;
}
}
if(!valid) {
cout << "Invalid gate no!!" << endl;
}
}
return gateNo;
} void showMovieInfo(int gateNo, bool showMovieNameOnly = false) {
char movies[3][100] = {"Movie: Beauty and the beast", "Movie: The Circle", "Movie: Boss Baby"};
char timing[3][100] = {"Time: 1:00pm", "Time: 3:00pm", "Time: 5:00pm"}; cout << movies[gateNo - 1] << endl;
if(!showMovieNameOnly) { cout << timing[gateNo -1] << endl;
cout << "Gate: " << gateNo << endl;
} } void menu() {
int gateNo; // integer for gate number
int choice;
while(true) {
cout << "1. Check movies, their time and gate\n2. Exit\n";
choice = getChoice();
if(choice == 1) {
char ch = 'y';
cout << "Movies with their time and gate..." << endl;
while( ch=='y' || ch=='Y'){
//user prompt for gate number
for(int i = 1; i <= 3; i++) {
cout << i << ". ";
showMovieInfo(i, true);
}
gateNo = getGateNo();
showMovieInfo(gateNo);
// user prompt to continue
cout << endl << "To cont... press[Y/N]: "; cin >> ch;
}
} else {
cout << "Thanks for using Movies menu program!" << endl;
break;
} } } int main()
{
menu();
system("pause");
return 0;
}

Attachments:

Answers

(15)
Status NEW Posted 10 Jul 2017 06:07 AM My Price 6.00

-----------

Attachments

file 1499669960-Solutions file.docx preview (51 words )
S-----------olu-----------tio-----------ns -----------fil-----------e -----------Hel-----------lo -----------Sir-----------/Ma-----------dam----------- T-----------han-----------k y-----------ou -----------for----------- yo-----------ur -----------int-----------ere-----------st -----------and----------- bu-----------yin-----------g m-----------y p-----------ost-----------ed -----------sol-----------uti-----------on.----------- Pl-----------eas-----------e p-----------ing----------- me----------- on----------- ch-----------at -----------I a-----------m o-----------nli-----------ne -----------or -----------inb-----------ox -----------me -----------a m-----------ess-----------age----------- I -----------wil-----------l b-----------e q-----------uic-----------kly----------- on-----------lin-----------e a-----------nd -----------giv-----------e y-----------ou -----------exa-----------ct -----------fil-----------e a-----------nd -----------the----------- sa-----------me -----------fil-----------e i-----------s a-----------lso----------- se-----------nt -----------to -----------you-----------r e-----------mai-----------l t-----------hat----------- is----------- re-----------gis-----------ter-----------ed -----------onÂ----------- th-----------is -----------web-----------sit-----------e -----------Tha-----------nk -----------you----------- -----------
Not Rated(0)