Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Airplane Gate Scheduler: Your task is to develop a tool that assists Airport Ope

ID: 3788885 • Letter: A

Question

Airplane Gate Scheduler: Your task is to develop a tool that assists Airport Operations managers in allocating Boarding gates to scheduled airline flights. Each Operations Manager should input how many gates they have to schedule (Expect 2 to 5 gates). The operations manager will have an arbitrarily long list of flights in a text file with the following format:

Airline Code (2 char code, such as AS, AA, DL, etc.)

Flight Number: (String – 4 chars)

Arrival Time: (hhmm 24 hour clock)

Example: AA 241 1420

   AS 31 1142

Additional Constraints:

The airport is only open from 0600 to 2300. Planes cannot depart or arrive when the airport is closed.

Each plane will only be on the ground for 1 hour. After that, the gate is free.

The flights file may not be in order of arrivals.

Do not assume that you can schedule all the flights on the list. Notify the Operations Manager when you cannot schedule a flight, and the reason, i.e. gates full at that arrival time.

Assume that there will be more flights than you have gate time, so you will need to use all the gates.

You only need to schedule the flights on a single operational day, all flights are for same day.

The only optimization needed is to schedule the next flight as close a departing flight as possible, therefore, minimizing gaps where a gate isn’t being used. Once you schedule a flight, don’t move it around to make space for other flights

The implementation must use linked lists (SLL, DLL CLL, etc).

Output –

Output 1: of the program should be a listing by Gate of each flight in order of time, starting with the earliest flight of the day and ending with the latest flight of the day.

Output 2: A list of unscheduled flights

Output 3: A listing, by gate of the remaining available valid slots for Airplanes (should one happen to arrive unexpectedly, the Operations Manager would like to know which gate would be available.)

--------FlightList.txt-----

YP 3102 1709
MZ 1350 1820
GC 2079 0830
SX 2079 1720
VV 9644 2319
AJ 7406 1147
RS 2750 1415
DO 2566 1359
KE 4995 2110
UY 2039 1646
AH 4167 0542
GB 5584 0245
DZ 9970 0442
NQ 7644 1053
TY 9789 2007
LZ 5296 2326
VM 6606 0351
VC 7148 0622
GZ 8491 0444
PM 9257 1515

Explanation / Answer

#include <iostream>

#include <iomanip>

#include <string>

using namespace std;

class Time

{

               private:

               time_t rawtime;

               public:

               struct tm * timeinfo;

               Time()

{

               time ( &rawtime );

               timeinfo = localtime ( &rawtime );

               }

};

class Passenger

{

               private:

               string info;

               public:

               string id;

               map<string, string>::iterator it;

               map<string,string> data;

               Passenger()

               {

                              getPassengerList();

               }

               void getPassengerList()

               {

                              ifstream file("ResevationList.txt", ios::in);

                              if(!file)

                              {

                                             cout << "File was not exist ";

                              }

                              it = data.begin();

                              while(!file.eof())

                              {

                                             getline(file,id,' ');

                                             getline(file,info,' ');

                                             data.insert(it,pair<string,string> (id,info));

                                             it++;      

                              }

                              file.close();

               }

};

class outputData : public Passenger

{

               public:

               Passenger pa;   

               fstream files;

               void menu(string &filename,int counter,int i,string &temp,string &id)

               {

                              writePlist(filename,id,temp);

                              writeRlist(id,temp);

               }

               void NewData(string &filename,int counter,int i,string &temp,string &id)

               {

                              NewDataWriteRlist(filename,id,temp);

               }

             void NewDataWriteRlist(string &filename,string& id, string& temp)

             {

                            int points;

               fstream files;

               string temp6;

               files.open(filename.c_str(),ios::in|ios::out|ios::app);

               files.seekg(0,ios::end);

               points = files.tellg();

               if(points == 0)

                            {

                                           files << "****** PASSENGER LIST FOR " << filename.c_str() << "******** "<<endl;

                                           files << endl;

                                           files << HEAD_1;

                              files << HEAD_2;

                                             files << HEAD_1;

                              }

                              files << id << " " << temp <<endl;

                            files.close();

             }

               void writeRlist(string& id, string& temp)

               {

                              files.open("ResevationList.txt", ios::out);

                              // files.open("ResevationList.txt", ios::out);

                              pa.data.erase(id);

                              for (pa.it = pa.data.begin(); pa.it != pa.data.end(); pa.it++ )

                              {

                              files << pa.it -> first << " " << pa.it -> second << endl;

                            }

                            files.close();

               }

class checkIn : public Passenger

{

               private:

               char yes_no;

               outputData op;

               int i; string filename;

               checkIn():Passenger()

               {

                              getNum(id);

                              printData(id);

                              temp = pa.data.find(id) -> second;

                              fixData(id,filename,counter,i,temp);

                              op.menu(filename,counter,i,temp,id);

               }

               void fixData(string &id,string &filename,int &counter, int &i,string &temp)

               {

                              divData(counter,i,temp);

                              putData(id,counter);

                              while(toupper(getYN()) == 'Y')

                              {

                                             menu = getMenu();

                                             getCase(menu);

                              }

                              getFilename(filename);

                              putData(id,counter);

               }

               int getMenu()

               {

                   system("clear");

                              //system("CLS");

                   cout << "**** UPDATE MENU ******"<<endl;

                              cout << "1) Flight # "   << setw(21)    << "4) Destenation "<< endl;

                              cout << "2) Gate # "     << setw(18)    << "5) Seat # "<< endl;

                              cout << "3) Depart time "<< setw(12)    << "6) Status"<<endl

                              cin >> menu;

                   }

                   return menu;

               }

               void divData(int &counter,int &i,string &temp)

               {

        i=0;

                              for(i;!temp.empty();i++)

                              {

                                             point = temp.find(' ');

                                             temp2[i] = temp.substr(0,point);

                                             temp = temp.substr(point);

                                  point2 = temp.find(' ');

                                             temp = temp.substr(1);

                              }

                              counter = i;

               }

               void putData(string &id,int &counter)

               {

                              int counter3 = 0;

                              system("clear");

                              //system("CLS");

                              string newdata;

                              cout << endl;

                            for(counter3;counter3 < counter;counter3++)

                            {

                              newdata.append(temp2[counter3]);

                              newdata.push_back(' ');

                            }

                              pa.data.erase(id);

                 pa.data.insert(pair<string,string>(id,newdata));

                 printData(id);

               }

               void getFilename(string &filename)

               {

               filename.append(temp2[4]);

               filename.append(".txt");

               cout<<filename<<endl;

               }

               void getCase(int &menu)

               {

                              string fix;

                              switch(menu)

                              {  

                                             cin.ignore(' ',100);

                                             case 1:

                                             cout << "New flight name : ";

                                             cin.ignore(100,' ');

                                             getline(cin,fix);

                                             temp2[4] = fix;

                                             break;

                                             case 2:

                                             cout << "New Gate Number : ";

                                             cin.ignore(100,' ');

                                             getline(cin,fix);

                                             temp2[5] = fix;

                                             break;

                                             case 3:

                                             cout << "New Departure Time : ";

                                             cin.ignore(100,' ');        

                                             getline(cin,fix);

                                             temp2[6] = fix;

                                             break;

                                             case 4:

                                             cout << "New Destination : ";

                                             cin.ignore(100,' ');        

                                             getline(cin,fix);

                                             temp2[7] = fix;

                                             break;

                                             case 5:

                                             cout << "New Seat Number : ";

                                             cin.ignore(100,' ');        

                                             getline(cin,fix);

                                             temp2[3] = fix;

                                             break;

                                             case 6:

                                             cout << "New Status : ";

                                             cin.ignore(100,' ');        

                                             getline(cin,fix);

                                             temp2[11] = fix;

                                             break;

               }

               }

               void printData(string &id)

               {

                              cout << HEAD_1;

                              cout << HEAD_2;

                              cout << id <<' '<< pa.data.find(id) -> second << endl;

               }

               void getNum(string &id)

               {

                              cout << "Enter a Reservation Number : ";

                              cin >> id

               char getYN()

               {

                              cout << "Fix data (Yes = Y / No = N)?" <<endl;

                              cin >> yes_no;

                              while((toupper(yes_no) != 'Y')&&(toupper(yes_no) != 'N'))

                              {

                                             cout << "Your request is invalid "<<endl;

                                             cout << "Fix data (Yes = Y / No = N)?"<<endl;

                                             cin >> yes_no;

                              }

                              return yes_no;

               }

};

class createData : public Passenger

{

               private:

               string paData[12];

               outputData op;

               Passenger pa;

               string id;

               public:

               string filename;

               string newdata;

               int counter3;

               int i;

               createData()

               {

                              getData();

                              getMap(id,newdata);

                              getFilename(filename);

                              op.NewData(filename,counter3,i,newdata,id);

               }

               void getFilename(string &filename)

               {

               filename.append(paData[5]);

               filename.append(".txt");

               }

               void getMap(string &id,string &newdata)

               {

                              i = 12;

                              counter3 = 1;

                            for(counter3;counter3 < i;counter3++)

                            {

                              newdata.append(paData[counter3]);

                              newdata.push_back(' ');

                            }

                            id = paData[0];

                              pa.data.insert(pair<string,string>(id,newdata));

               }

               void getData()

               {

                              string newCost;

                              cout << "***** NEW PASSENGER INFO *****" << endl;

                              cout << "Enter a Conform Numbr : ";

                              cin.ignore(1,' ');

                              getline(cin,newCost);

                              while(newCost.length() != 5)

                              {

                                             cout << "***** Error *****"<< endl;

                                             cout << "Conf Number must be 5 degit "<< endl;

                                             cout << "Try Conf Number again "<<endl;

                                             cout << "Conformation Number : ";

                                             getline(cin,newCost);

                              }

                              paData[0] = newCost;

                              cout << "Enter a Passenger Name : ";

                              getline(cin,newCost);

                              paData[1] = newCost;

                              cout << "Enter a Age : ";

                              getline(cin,newCost);

                              paData[2] = newCost;

                              cout << "Enter a Passport Number : ";

                              getline(cin,newCost);

                              paData[3] = newCost;

                              cout << "Enter a Seat Number : ";

                              getline(cin,newCost);

                              paData[4] = newCost;

                              cout << "Enter a Fright Number : ";

                              getline(cin,newCost);

                              paData[5] = newCost;

                              cout << "Enter a Gate Number : ";

                              getline(cin,newCost);

                              paData[6] = newCost;

                              cout << "Enter a Dapart : ";

                              getline(cin,newCost);

                              paData[7] = newCost;

                              cout << "Enter a Destination : ";

                              getline(cin,newCost);

                              paData[8] = newCost;

                              cout << "Enter a Bagage Number : ";

                              getline(cin,newCost);

                              paData[9] = newCost;

                              cout << "Enter a Bagage Amount : ";

                              getline(cin,newCost);

                              paData[10] = newCost;

                              cout << "Enter a Status : ";

                              getline(cin,newCost);

                              paData[11] = newCost;

               }

};

int main(void)

{

               int len;

               string id;

               string info;

               int menu;

               char yes_no;

               system("clear");

if(!file)

               {

                              cout << "File was not exist ";

               }*/

               int counter = 0;

               do{

                              Time tm;

                              system("clear");

                              //system("CLS");

                              cout << "CHECK IN SYSTEM FOR DOMESTIC / INTERNATIONAL AIRLINE "<<endl;

                              cout << asctime (tm.timeinfo);

                            cout << "***** Menu ******"<<endl;

                            cout << "1) Check In "<< endl;

                            cout << "2) New Customer " << endl;

                            cout << "3) Cancel "<< endl

                              cout << asctime (tm.timeinfo);

                              if(menu == 1)

                              {

                                  checkIn();                                     

                              }

                              if(menu == 2)

                              {

                                  createData();

                              }

                              if(menu == 3)

                              {

                                                            break;

                              }

               }while(menu != 3);

               return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote