Phase 3 C++

Anonymous
timer Asked: Dec 12th, 2017
account_balance_wallet $70

Question description

hello,

I have a homework in C++, I have done phase 1 and 2 and I need help in phase 3. I have to use ((Visual Studio 2015 only)). I will drop two files. the first file is the instructions and the second file is the Phase 2. You have to use phase 2 to complete phase 3. the files are in word document. copy phase 2 code and paste it in Visual Studio 2015. After you done, make sure the code is working please. I need the new phase 3 code in word document too.

thanks

thanks

INFS2184 C++ project files – Fall 2017 • Phase I – 150 pts. due date Oct.26 • Phase II – 500 pts. due date Nov.16 • Phase III – 500pts. due date Dec.10 *Please note that assignments turned in late will be assessed late points* C++ Project – Phase I – 150 points DUE DATE – Oct 26 (NO late programs accepted. The solution will be posted at midnight Oct 26) This will be Phase #1 of a continuous project. You will be creating the entire structure of a program that will be completed in pieces (phases) In this phase of the project, you are to make calls to functions, but the functions will have only a cout statement in them. This is called a stub. The program will call the proper function, but each function will be completed later. You are to create a program that will keep track of information for an Airline. The program will be menu driven. Your menu is to look something like the following: ACME Airline System 1. 2. 3. 4. Add/modify Flight information Add/modify Reservation information Report Section Exit Airline System Please make your selection > In this first phase you are to write the complete function for the menu and stubs for all of the other functions. The names and definitions of the functions are as follows: ▪ Menu – function that will print the above menu and will return the user’s selection by value to the main program ▪ Modify_flight– stub- to be completed in a later phase ▪ Modify_reservation- stub -to be completed in a later phase ▪ Report – stub- to be completed in a later phase You must use the above names for the functions in your program. Each function, except the menu function will just be a stub and when called, will print a message to the user that the function has been executed. Control will then pass back to the menu. You will need a while loop to keep the program running until the user picks “4.Exit Airline System “ • ▪ You are also to create two other functions called read_flight and read_reservation that will run only once at the beginning of your program. Create another function called exit_program that will run only once at the end of your program. These functions will also be stubs. - to be completed in a later phase Please copy the code to a Word document along with screen prints of the program running. Upload the document to Blackboard C++ Phase II 500 points - Due date Nov 16 You are to use the code from Phase I and add to it. You are to add code to the following functions: ✓ Read_flight • This function will be the first thing to run when your program executes. This function will open a text file called flight.dat and read flight information into parallel arrays. This data file is on blackboard and must be copied into the folder of your C++ project where your .cpp file is. The flight information that will be read in is as follows: ▪ Flight number (a four digit integer code) ▪ Flight city origin (string) ▪ Flight city destination (string) ▪ Flight date (string) ▪ Flight time (string) ▪ Flight seats(int) ✓ Read_reservation • This function run right after read_flight and will open a file called reservation.dat and read reservation information into a second set of parallel arrays. This data file is on the shell and must be copied into the folder of your C++ project where the .cpp file is. The reservation information that will be read in is as follows: ▪ Reservation code ( a four digit integer code) ▪ Flight number ( a four digit integer code) ▪ Last name (string) ▪ First name (string) ▪ Type of seat (string) business, coach, first ▪ Cost of seat (double) ✓ Report When this function is called, the following menu will print: Acme Airlines 1. All flight Info 2. All Reservation Info 3. Value of reservations of a specific type 4. All Reservations on a specific flight 5. Report 5 6. Report 6 7. Report 7 8. Report 8 9. Exit Report Menu Please make your selection > The above menu will keep running until the user selects 6. Exit Report Menu Each report is defined as follows: 1. All flight Info – Displays all information on all flights 2. All Reservation Info –Display all reservation information 3. Prompt for the type of seat and print all reservations of that type. Also calculate and print the total value of that reservation type 4. Prompt for the flight number and print the reservations on that flight 5. Reports 5,6,7,8 will be defined in phase III of the project You are to upload a word document to blackboard that contains the following: • Source code for the program • Screen shot of each report running on the screen C++ Phase III 500 points Due Date Dec 10- Nothing accepted late You are to add code to your Phase II code to do the following: 1. In this phase of the project, you are to add a user defined class. All arrays, counts and functions are to be members of this new class. Therefore, you will NOT pass any data to any functions anymore. 2. Modify_Flight – Add code to this function as follows: In this function you are to first print another menu something like the following: Modify Flight Information Menu 1. Add Flight 2. Delete Flight 3. Modify Flight 4. Exit this menu • When the user picks menu option #1, prompt the user for new flight information and store it in the parallel arrays • When the user picks menu option #2, prompt the user for the flight number, search the arrays for the flight and delete the flight from the arrays • When the user picks menu option #3, prompt the user for the flight number, search the arrays for the flight, ask the user what they want to change, (you can not change the flight number) and store the value in the proper array 3. Modify_reservation -Add code to this function as follows: This function will prompt for new reservation information and add it to the reservation arrays 4. Exit_program-Add code to this function as follows: This function will write all data from the two sets of parallel arrays back to the flight.dat and the reservation.dat files. Therefore, if the user entered new data or deleted data, the current arrays would be overwritten back to the data files. Then, the next time the program would run, that new data would be read in. 5. Report -Add code to this function as follows: In this function, you are to finish the reports. • Report #5 – All flights from a specific city – prompt the user for the city, search the flight arrays and print all flight information for flights from that city, including the count of all reservations on that flight • Report #6 – Specific reservation information – prompt the user for the reservation code, search the reservation arrays and print the information on that reservation, then also print the flight information from the flight arrays for that specific reservation • Report #7 – Summary of all flights – first print the flight information for one flight from the flight arrays, then go to the reservation arrays and print all reservations for that flight. Then go on to the next flight etc… • Report #8 – This report is of your choice You are to upload a word document to blackboard containing the following: • Your source code • Screen shots of all the reports • Screen shots of all of the additional functionality (the modify flights and reservations)
Ahmed Almaghrabi 30/11/2017 #include #include #include using namespace std; int main() { void modify_reservation(); void modify_flight(); void exit_program(); int selection, i = 0; int f_count, f_num, f_seat; string f_city_dep, f_city_arrival, f_date, f_time; int r_count, r_num; string r_last, r_first, r_seat; double r_cost; //flight array int flight_number[100]; string flight_city_orgin[100]; string flight_city_destination[100]; string flight_date[100]; string flight_time[100]; int flight_seats[100]; int fcount = -1; //reservation array int reservation_code[100]; int r_flight_number[100]; string last_name[100]; string first_name[100]; string type_of_seat[100]; double cost_of_seat[100]; int rcount = -1; ifstream infile; ofstream outfile; void Report(int fcount, int flight_number[], string flight_city_orgin[], string flight_city_destination[], string flight_date[], string flight_time[], int flight_seats[], int rcount, int reservation_code[], int r_flight_number[], string last_name[], string first_name[], string type_of_seat[], double cost_of_seat[]); int menu(); int read_flight(int fcount, int flight_number[], string flight_city_orgin[], string flight_city_destination[], string flight_date[], string flight_time[], int flight_seats[]); int read_reservation(int rcount, int reservation_code[], int r_flight_number[], string last_name[], string first_name[], string type_of_seat[], double cost_of_seat[]); fcount = read_flight(fcount, flight_number, flight_city_orgin, flight_city_destination, flight_date, flight_time, flight_seats); rcount = read_reservation(rcount, reservation_code, r_flight_number, last_name, first_name, type_of_seat, cost_of_seat); selection = menu(); while (selection != 4) { if (selection == 1) { modify_flight(); } else if (selection == 2) { modify_reservation(); } else if (selection == 3) { Report(fcount, flight_number, flight_city_orgin, flight_city_destination, flight_date, flight_time, flight_seats, rcount, reservation_code, r_flight_number, last_name, first_name, type_of_seat, cost_of_seat); } selection = menu(); } exit_program(); system("pause"); return 0; } int menu() { string value; int selection; cout cout cout cout cout << << << << << "ACME " << endl; "1 Add/modify Flight information" << endl; "2 Add/modify Reservation information" << endl; "3 Report Section" << endl; "4 Exit Airline System" << endl; cin >> selection; return selection; } int read_flight(int fcount, int flight_number[], string flight_city_orgin[], string flight_city_destination[], string flight_date[], string flight_time[], int flight_seats[]) { ifstream infile; infile.open("flight.dat"); while (!infile.eof() && !infile.fail()) { fcount = fcount + 1; //read the input file infile >> flight_number[fcount] >> flight_city_orgin[fcount] >> flight_city_destination[fcount] >> flight_date[fcount] >> flight_time[fcount] >> flight_seats[fcount]; } infile.close(); return fcount; }//end read_flight int read_reservation(int rcount, int reservation_code[], int r_flight_number[], string last_name[], string first_name[], string type_of_seat[], double cost_of_seat[]) { ifstream infile; infile.open("reservation.dat"); while (!infile.eof() && !infile.fail()) { rcount = rcount + 1; //read the input file infile >> reservation_code[rcount] >> r_flight_number[rcount] >> last_name[rcount] >> first_name[rcount] >> type_of_seat[rcount] >> cost_of_seat[rcount]; } infile.close(); return rcount; }//end start_program void modify_flight() { cout << "Modify flight Information " << endl; } void Report(int fcount, int flight_number[], string flight_city_orgin[], string flight_city_destination[], string flight_date[], string flight_time[], int flight_seats[], int rcount, int reservation_code[], int r_flight_number[], string last_name[], string first_name[], string type_of_seat[], double cost_of_seat[]) { int i = 0; string value; int selection; cout << "======= Acme Airlines ======= " << endl; cout << "All flight info " << endl; cout << "All reservation info" << endl; cout << "Value of reservations od a specific type" << endl; cout << "All reservations on a specific flight" << endl; cout << "Report 5" << endl; cout cout cout cout << << << << "Report 6" << endl; "Report 7" << endl; "Report 8" << endl; "Exit report menu" << endl; cin >> selection; while (selection != 9) { if (selection == 1) { cout << "All flight info " << endl; cout << "================ " << endl; for (i = 0; i < fcount; ++i) { cout << flight_number[i] << " " << flight_city_orgin[i] << " " << flight_city_destination[i] << " " << flight_date[i] << " " << flight_time[i] << " " << flight_seats[i] << endl; } } else if (selection == 2) { cout << "All reservation info " << endl; cout << "================ " << endl; for (i = 0; i < rcount; ++i) { cout << reservation_code[i] << " " << r_flight_number[i] << " " << last_name[i] << " " << first_name[i] << " " << type_of_seat[i] << " " << cost_of_seat[i] << endl; } } else if (selection == 3) { double total = 0; string type; cout << "Enter the seat type (business, coach, first" << endl; cin >> type; for (i = 0; i < rcount; ++i) { if (type == type_of_seat[i]) { cout << reservation_code[i] << " " << r_flight_number[i] << " " << last_name[i] << " " << first_name[i] << " " << type_of_seat[i] << " " << cost_of_seat[i] << endl; total += cost_of_seat[i]; } } cout << "the total for the seat type " << type << "is " << total << endl; } else if (selection == 4) { int flight; cout << "Enter flight number (4 digit)" << endl; cin >> flight; for (i = 0; i < rcount; ++i) { if (flight == r_flight_number[i]) { cout << reservation_code[i] << " " << r_flight_number[i] << " " << last_name[i] << " " << first_name[i] << " " << type_of_seat[i] << " " << cost_of_seat[i] << endl; } } } else if (selection == 5) { cout << "Report 5" << endl; } else if (selection == 6) { cout << "Report 6" << endl; } else if (selection == 7) { cout << "Report 7" << endl; } else if (selection == 8) { cout << "Report 8" << endl; } else if (selection == 9) { } cout cout cout cout cout cout cout cout cout cout << << << << << << << << << << "======= Acme Airlines ======= " << endl; "All flight info " << endl; "All reservation info" << endl; "Value of reservations od a specific type" << endl; "All reservations on a specific flight" << endl; "Report 5" << endl; "Report 6" << endl; "Report 7" << endl; "Report 8" << endl; "Exit report menu" << endl; cin >> selection; } } void modify_reservation() { cout << "modify Reservation information" << endl; } void exit_program() { cout << "Exit Program" << endl; }
Ahmed Almaghrabi 30/11/2017 #include #include #include using namespace std; int main() { void modify_reservation(); void modify_flight(); void exit_program(); int selection, i = 0; int f_count, f_num, f_seat; string f_city_dep, f_city_arrival, f_date, f_time; int r_count, r_num; string r_last, r_first, r_seat; double r_cost; //flight array int flight_number[100]; string flight_city_orgin[100]; string flight_city_destination[100]; string flight_date[100]; string flight_time[100]; int flight_seats[100]; int fcount = -1; //reservation array int reservation_code[100]; int r_flight_number[100]; string last_name[100]; string first_name[100]; string type_of_seat[100]; double cost_of_seat[100]; int rcount = -1; ifstream infile; ofstream outfile; void Report(int fcount, int flight_number[], string flight_city_orgin[], string flight_city_destination[], string flight_date[], string flight_time[], int flight_seats[], int rcount, int reservation_code[], int r_flight_number[], string last_name[], string first_name[], string type_of_seat[], double cost_of_seat[]); int menu(); int read_flight(int fcount, int flight_number[], string flight_city_orgin[], string flight_city_destination[], string flight_date[], string flight_time[], int flight_seats[]); int read_reservation(int rcount, int reservation_code[], int r_flight_number[], string last_name[], string first_name[], string type_of_seat[], double cost_of_seat[]); fcount = read_flight(fcount, flight_number, flight_city_orgin, flight_city_destination, flight_date, flight_time, flight_seats); rcount = read_reservation(rcount, reservation_code, r_flight_number, last_name, first_name, type_of_seat, cost_of_seat); selection = menu(); while (selection != 4) { if (selection == 1) { modify_flight(); } else if (selection == 2) { modify_reservation(); } else if (selection == 3) { Report(fcount, flight_number, flight_city_orgin, flight_city_destination, flight_date, flight_time, flight_seats, rcount, reservation_code, r_flight_number, last_name, first_name, type_of_seat, cost_of_seat); } selection = menu(); } exit_program(); system("pause"); return 0; } int menu() { string value; int selection; cout cout cout cout cout << << << << << "ACME " << endl; "1 Add/modify Flight information" << endl; "2 Add/modify Reservation information" << endl; "3 Report Section" << endl; "4 Exit Airline System" << endl; cin >> selection; return selection; } int read_flight(int fcount, int flight_number[], string flight_city_orgin[], string flight_city_destination[], string flight_date[], string flight_time[], int flight_seats[]) { ifstream infile; infile.open("flight.dat"); while (!infile.eof() && !infile.fail()) { fcount = fcount + 1; //read the input file infile >> flight_number[fcount] >> flight_city_orgin[fcount] >> flight_city_destination[fcount] >> flight_date[fcount] >> flight_time[fcount] >> flight_seats[fcount]; } infile.close(); return fcount; }//end read_flight int read_reservation(int rcount, int reservation_code[], int r_flight_number[], string last_name[], string first_name[], string type_of_seat[], double cost_of_seat[]) { ifstream infile; infile.open("reservation.dat"); while (!infile.eof() && !infile.fail()) { rcount = rcount + 1; //read the input file infile >> reservation_code[rcount] >> r_flight_number[rcount] >> last_name[rcount] >> first_name[rcount] >> type_of_seat[rcount] >> cost_of_seat[rcount]; } infile.close(); return rcount; }//end start_program void modify_flight() { cout << "Modify flight Information " << endl; } void Report(int fcount, int flight_number[], string flight_city_orgin[], string flight_city_destination[], string flight_date[], string flight_time[], int flight_seats[], int rcount, int reservation_code[], int r_flight_number[], string last_name[], string first_name[], string type_of_seat[], double cost_of_seat[]) { int i = 0; string value; int selection; cout << "======= Acme Airlines ======= " << endl; cout << "All flight info " << endl; cout << "All reservation info" << endl; cout << "Value of reservations od a specific type" << endl; cout << "All reservations on a specific flight" << endl; cout << "Report 5" << endl; cout cout cout cout << << << << "Report 6" << endl; "Report 7" << endl; "Report 8" << endl; "Exit report menu" << endl; cin >> selection; while (selection != 9) { if (selection == 1) { cout << "All flight info " << endl; cout << "================ " << endl; for (i = 0; i < fcount; ++i) { cout << flight_number[i] << " " << flight_city_orgin[i] << " " << flight_city_destination[i] << " " << flight_date[i] << " " << flight_time[i] << " " << flight_seats[i] << endl; } } else if (selection == 2) { cout << "All reservation info " << endl; cout << "================ " << endl; for (i = 0; i < rcount; ++i) { cout << reservation_code[i] << " " << r_flight_number[i] << " " << last_name[i] << " " << first_name[i] << " " << type_of_seat[i] << " " << cost_of_seat[i] << endl; } } else if (selection == 3) { double total = 0; string type; cout << "Enter the seat type (business, coach, first" << endl; cin >> type; for (i = 0; i < rcount; ++i) { if (type == type_of_seat[i]) { cout << reservation_code[i] << " " << r_flight_number[i] << " " << last_name[i] << " " << first_name[i] << " " << type_of_seat[i] << " " << cost_of_seat[i] << endl; total += cost_of_seat[i]; } } cout << "the total for the seat type " << type << "is " << total << endl; } else if (selection == 4) { int flight; cout << "Enter flight number (4 digit)" << endl; cin >> flight; for (i = 0; i < rcount; ++i) { if (flight == r_flight_number[i]) { cout << reservation_code[i] << " " << r_flight_number[i] << " " << last_name[i] << " " << first_name[i] << " " << type_of_seat[i] << " " << cost_of_seat[i] << endl; } } } else if (selection == 5) { cout << "Report 5" << endl; } else if (selection == 6) { cout << "Report 6" << endl; } else if (selection == 7) { cout << "Report 7" << endl; } else if (selection == 8) { cout << "Report 8" << endl; } else if (selection == 9) { } cout cout cout cout cout cout cout cout cout cout << << << << << << << << << << "======= Acme Airlines ======= " << endl; "All flight info " << endl; "All reservation info" << endl; "Value of reservations od a specific type" << endl; "All reservations on a specific flight" << endl; "Report 5" << endl; "Report 6" << endl; "Report 7" << endl; "Report 8" << endl; "Exit report menu" << endl; cin >> selection; } } void modify_reservation() { cout << "modify Reservation information" << endl; } void exit_program() { cout << "Exit Program" << endl; }

Tutor Answer

Dr.Bean
School: Duke University

Hey, the programm is taking a bit long to install, kindly add me 3 more hours,I will be done , may be even before that. Thank you.
Hey buddy, visual 2015 won't just run withbthe windows 10. I realized it needs the older versions, and I tried my best. I had to settle for visual 2017. Kindly let me know what you think. T...

flag Report DMCA
Review

Anonymous
Totally impressed with results!! :-)

Similar Questions
Hot Questions
Related Tags

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors