#include<iostream>
#include<iomanip>
#include<conio.h>
#include<string>
#include<windows.h>
#include<fstream>
using namespace std;
char Local_Destinationination[5][20]={"LAHORE","ISLAMABAD","KARACHI","PESHAWAR","QUETTA"};
char International_Destinationination[10][20]={"LONDON","BERLIN","DUBAI","NEW YORK","BEIJING","PARIS","CAPE TOWN","TOKYO","LOS ANGELES","MUMBAI" };
class Flight_Time
{
protected:
int choice;
public:
void getdata()
{
cout<<"ON WHICH TIME YOU WANT TO TRAVEL"<<endl;
cout<<"PRESS 1 FOR 11 AM"<<endl;
cout<<"PRESS 2 FOR 10 AM"<<endl;
cout<<"PRESS 3 FOR 9 AM"<<endl;
cin>>choice;
}
void show()
{
if(choice==1)
{
cout<<"| "<<endl;
cout<<"|flight Flight_Time 11 AM "<<endl;
cout<<"|_________________________________________________________________________"<<endl;
cout<<" GOOD BYE AND HAVE A SAFE JOURNEY "<<endl;
ofstream outfile;
outfile.open("E:\\E_ticket.txt",ios::app);
outfile<<"| "<<endl<<
"|flight Flight_Time 11 AM "<<endl<<
"|_________________________________________________________________________"<<endl<<
" GOOD BYE AND HAVE A SAFE JOURNEY "<<endl;
}
if(choice==2)
{
cout<<"| "<<endl;
cout<<"|flight Flight_Time 10 AM "<<endl;
cout<<"|_________________________________________________________________________"<<endl;
cout<<" GOOD BYE AND HAVE A SAFE JOURNEY "<<endl;
ofstream outfile;
outfile.open("E:\\E_ticket.txt",ios::app);
outfile<<"| "<<endl<<
"|flight Flight_Time 10 AM "<<endl<<
"|_________________________________________________________________________"<<endl<<
" GOOD BYE AND HAVE A SAFE JOURNEY "<<endl;
}
if(choice==3)
{
cout<<"| "<<endl;
cout<<"|flight Flight_Time 9 AM "<<endl;
cout<<"|_________________________________________________________________________"<<endl;
cout<<" GOOD BYE AND HAVE A SAFE JOURNEY "<<endl;
ofstream outfile;
outfile.open("E:\\E_ticket.txt",ios::app);
outfile<<"| "<<endl<<
"|flight Flight_Time 9 AM "<<endl<<
"|_________________________________________________________________________"<<endl<<
" GOOD BYE AND HAVE A SAFE JOURNEY "<<endl;
}
}
};
class passenger
{
public:
virtual void getdata()
{
}
virtual void show()
{
}
};
class booking : public passenger
{
protected:
char ch;
char First_Name[60];
char Last_Name[60];
char Address[60];
char Current_Location[30];
char Destination[30];
char Reservation_No[60];
int Option;
public:
void getdata()
{
cout<<setw(40)<<"\n\n ::Please enter the required information for passenger number::"<<endl;
cout<<"\n\n\nEnter the First_Name of passenger: ";
cin.getline(First_Name,60);
cout<<endl;
cout<<"Enter the Last_Name of passenger: ";
cin.getline(Last_Name,60);
cout<<endl<<endl;
cout<<"Enter Address of passenger: ";
cin.getline(Address,60);
cout<<endl<<endl;
cout<<"Enter the Resevation No. of Ticket"<<endl;
cin.getline(Reservation_No,60);
cout<<endl;
cout<<"Enter the current location of passenger(IN CAPITAL LETTERS ONLY): ";
cin.getline(Current_Location,60);
cout<<endl<<endl;
cout<<"Enter the Destinationination of passenger(IN CAPITAL LETTERS ONLY): ";
cin.getline(Destination,60);
cout<<endl<<endl;
system("CLS");
}
void show()
{
cout<<setw(40)<<"Your E-Ticket is :"<<endl;
int Ticket_No=1;
int Reference_No=12345;
cout<<" AIRLINE TICKET "<<endl;
cout<<"|Ticket No."<<Ticket_No<<" Reference No."<<Reference_No<<"\t "<<endl;
cout<<"|_________________________________________________________________________"<<endl;
cout<<"|Resevation No. :"<<Reservation_No<<" "<<endl;
cout<<"|__________________________________________________________________________"<<endl;
cout<<"|Passenger Information : "<<endl;
cout<<"|Name :"<<Last_Name<<"/"<<First_Name<<" "<<endl;
cout<<"| "<<endl;
cout<<"|Address :"<<Address<<" "<<endl;
cout<<"|_________________________________________________________________________"<<endl;
cout<<"|flight Information : "<<endl;
cout<<"|12 aug 2011 "<<endl;
cout<<"|BOING 747 "<<endl;
cout<<"|_________________________________________________________________________"<<endl;
cout<<"|Depart :"<<Current_Location<<" "<<endl;
cout<<"|Arrive :"<<Destination<<" "<<endl;
cout<<"|*BAGGAGE allowed 40 Kilos "<<endl;
cout<<"|*contact Airline to Confirm baggage allowance "<<endl;
cout<<"|_________________________________________________________________________"<<endl;
ofstream outfile("E:\\E_ticket.txt");
outfile<<" AIRLINE TICKET "<<endl<<
"|Ticket No."<<Ticket_No <<" Reference No."<<Reference_No<<"\t "<<endl<<
"|_________________________________________________________________________"<<endl<<
"|Resevation No. :"<<Reservation_No<<" "<<endl<<
"|__________________________________________________________________________"<<endl<<
"|Passenger Information : "<<endl<<
"|Name :"<<Last_Name<<"/"<<First_Name<<" "<<endl<<
"| "<<endl<<
"|Address :"<<Address<<" "<<endl<<
"|_________________________________________________________________________"<<endl<<
"|flight Information : "<<endl<<
"|12 aug 2011 "<<endl<<
"|BOING 747 "<<endl<<
"|_________________________________________________________________________"<<endl<<
"|Depart :"<<Current_Location<<" "<<endl<<
"|Arrive :"<<Destination<<" "<<endl<<
"|*BAGGAGE allowed 40 Kilos "<<endl<<
"|*contact Airline to Confirm baggage allowance "<<endl<<
"|_________________________________________________________________________"<<endl;
Ticket_No=Ticket_No+1;
Reference_No= Reference_No +1;
}
};
class search
{
public:
void searching()
{
cout<<"FOLLOWING ARE THE INTERNATIONAL FLIGHTS AVAILABLE"<<endl;
for(int i=0;i<5;i++)
{
for(int j=0;j<10;j++)
{
cout<<"FLIGHT FROM "<<Local_Destinationination[i]<<" TO "<<International_Destinationination[j]<<endl;
}
}
}
};
class local: public booking
{
protected:
int Business_Seat;
int Economy_Seat;
int ch;
int k;
int p;
int Option;
Flight_Time t1;
public:
void getdata()
{
k=0;
p=0;
cout<<"In which AIRLINE you want to travel"<<endl<<endl;
cout<<"1)PIA"<<endl;
cout<<"2)AIR BLUE"<<endl;
cout<<"3)ARAB EMIRATES"<<endl;
cout<<"4)QATAR AIRWAYS"<<endl;
cout<<"enter your choice"<<endl;;
cin>>Option;
system ("cls");
switch(Option)
{
case 1:
if (Option==1)
cout<<setw(40)<<"\n\n\n WELCOME TO PIA"<<endl;
break;
case 2:
if(Option==2)
cout<<setw(40)<<"\n\n\n WELCOME TO AIRBLUE"<<endl;
break;
case 3:
if(Option==3)
cout<<setw(40)<<"\n\n\n WELCOME TO ARAB EMIRATES"<<endl;
break;
case 4:
if(Option==4)
cout<<setw(40)<<"\n\n\n WELCOME TO QATAR AIRWAYS"<<endl;
break;
}
cout<<setw(40)<<"\nTHESE ARE THE LOCAL PLACES AVAILABLE\n\n\n"<<endl;
cin.ignore();
for(int i=0;i<5;i++)
{
cout<<Local_Destinationination[i]<<endl;
}
booking::getdata();
for(int j=0;j<5;j++)
{
if(strcmp(Local_Destinationination[j],Current_Location)==0)
{
k++;
}
}
for( int i=0;i<5;i++)
{
if(strcmp(Local_Destinationination[i],Current_Location)==0)
{
p++;
}
}
if(k==1&&p==1)
{
cout<<" FLIGHT AVAILABLE ON THIS ROUTE"<<endl;
Business_Seat=30;
Economy_Seat=40;
cout<<"In which class you want to travel?"<<endl;
cout<<"Make your choice"<<endl<<endl;
cout<<"\n\n\n\n\n\n";
cout<<setw(60)<<"*************************************"<<endl;
cout<<setw(60)<<"* Press 1 for buisness class *"<<endl;
cout<<setw(60)<<"* Press 2 for economy class *"<<endl;
cout<<setw(60)<<"*************************************"<<endl<<endl<<endl<<endl;
cout<<"Enter your choice"<<endl;
cin>>ch;
cout<<endl;
switch(ch)
{
case 1:
Business_Seat--;
if(Business_Seat<=0)
cout<<"SORRY NO SEAT AVAILABLE"<<endl;
else
cout<<"SEAT AVAILABLE"<<endl;
break;
case 2:
Economy_Seat--;
if(Economy_Seat<=0)
cout<<"SORRY NO SEAT AVAILABLE"<<endl;
else
cout<<"SEAT AVAILABLE"<<endl;
break;
}
t1.getdata();
system("CLS");
booking::show();
if(ch==1)
{
cout<<"| "<<endl;
cout<<"|Ticket Information: "<<endl;
cout<<"|BUISNESS CLASS "<<endl;
ofstream outfile;
outfile.open("E:\\E_ticket.txt",ios::app);
outfile<<"| "<<endl<<
"|Ticket Information: "<<endl<<
"|BUISNESS CLASS "<<endl;
}
if(ch==2)
{
cout<<"| "<<endl;
cout<<"|Ticket Information: "<<endl;
cout<<"|ECONOMY CLASS "<<endl;
ofstream outfile;
outfile.open("E:\\E_ticket.txt",ios::app);
outfile<<"| "<<endl<<
"|Ticket Information: "<<endl<<
"|ECONOMY CLASS "<<endl;
}
cout<<"|Status: confirmed "<<endl;
ofstream outfile;
outfile.open("E:\\E_ticket.txt",ios::app);
outfile<<"|Status: confirmed "<<endl;
t1.show();
}
else
{
cout<<"__________________________________________________________________________"<<endl;
cout<<"| SORRY NO FLIGHT AVAILABLE ON THIS ROUTE RIGHT NOW "<<endl;
cout<<"__________________________________________________________________________"<<endl;
}
}
};
class international:public booking
{
protected:
int Business1_seat;
int Economy1_seat;
int choice;
int c;
int b;
int v;
char g;
Flight_Time t1;
public:
void getdata()
{
b=0;
v=0;
cout<<"In which AIRLINE you want to travel"<<endl<<endl;
cout<<"1)PIA"<<endl;
cout<<"2)AIR BLUE"<<endl;
cout<<"3)ARAB EMIRATES"<<endl;
cout<<"4)QATAR AIRWAYS"<<endl;
cout<<"enter your choice"<<endl;;
cin>>Option;
system ("cls");
switch(Option)
{
case 1:
if (Option==1)
cout<<setw(40)<<"\n\n\n WELCOME TO PIA"<<endl;
break;
case 2:
if(Option==2)
cout<<setw(40)<<"\n\n\n WELCOME TO AIRBLUE"<<endl;
break;
case 3:
if(Option==3)
cout<<setw(40)<<"\n\n\n WELCOME TO ARAB EMIRATES"<<endl;
break;
case 4:
if(Option==4)
cout<<setw(40)<<"\n\n\n WELCOME TO QATAR AIRWAYS"<<endl;
break;
}
cout<<"\n\nTHESE ARE THE INTERNATIONAL PLACES AVAILABLE"<<endl<<endl;
cin.ignore();
for(int i=0;i<10;i++)
{
cout<<International_Destinationination[i]<<endl;
}
booking::getdata();
for(int j=0;j<10;j++)
{
if(strcmp(International_Destinationination[j],Destination)==0)
{
v++;
}
}
for( int i=0;i<5;i++)
{
if(strcmp(Local_Destinationination[i],Current_Location)==0)
{
b++;
}
}
if(b==1&&v==1)
{
cout<<" FLIGHT AVAILABLE ON THIS ROUTE"<<endl;
Business1_seat=30;
Economy1_seat=40;
cout<<"In which class you want to travel?"<<endl;
cout<<"Make your choice"<<endl<<endl;
cout<<"\n\n\n\n\n\n";
cout<<setw(60)<<"*************************************"<<endl;
cout<<setw(60)<<"* Press 1 for buisness class *"<<endl;
cout<<setw(60)<<"* Press 2 for economy class *"<<endl;
cout<<setw(60)<<"*************************************"<<endl<<endl<<endl<<endl;
cout<<"Enter your choice"<<endl;
cin>>choice;
cout<<endl;
switch(choice)
{
case 1:
Business1_seat--;
if(Business1_seat<=0)
cout<<"SORRY NO SEAT AVAILABLE"<<endl;
else
cout<<"SEAT AVAILABLE"<<endl;
break;
case 2:
Economy1_seat--;
if(Economy1_seat<=0)
cout<<"SORRY NO SEAT AVAILABLE"<<endl;
else
cout<<"SEAT AVAILABLE"<<endl;
break;
}
t1.getdata();
system("CLS");
booking::show();
if(choice==1)
{
cout<<"| "<<endl;
cout<<"|Ticket Information: "<<endl;
cout<<"|BUISNESS CLASS "<<endl;
ofstream outfile;
outfile.open("E:\\E_ticket.txt",ios::app);
outfile<<"| "<<endl<<
"|Ticket Information: "<<endl<<
"|BUSINESS CLASS "<<endl;
}
if(choice==2)
{
cout<<"| "<<endl;
cout<<"|Ticket Information: "<<endl;
cout<<"|ECONOMY CLASS "<<endl;
ofstream outfile;
outfile.open("E:\\E_ticket.txt",ios::app);
outfile<<"| "<<endl<<
"|Ticket Information: "<<endl<<
"|ECONOMY CLASS "<<endl;
}
cout<<"|Status: confirmed "<<endl;
ofstream outfile;
outfile.open("E:\\E_ticket.txt",ios::app);
outfile<<"|Status: confirmed "<<endl;
t1.show();
}
else
{
cout<<"__________________________________________________________________________"<<endl;
cout<<"| SORRY NO FLIGHT AVAILABLE ON THIS ROUTE RIGHT NOW "<<endl;
cout<<"__________________________________________________________________________"<<endl;
}
}
};
class main_menu
{
private:
int menu_choice;
public:
void getdata()
{
m:
cout<<"\n\n\n\n\n\n";
cout<<setw(60)<<"*************************************"<<endl;
cout<<setw(60)<<"* AIRWAYS RESERVATION *"<<endl;
cout<<setw(60)<<"* MAIN MENU *"<<endl;
cout<<setw(60)<<"* ENTER YOUR CHOICE *"<<endl;
cout<<setw(60)<<"* PRESS 1 FOR LOCAL BOOKING *"<<endl;
cout<<setw(60)<<"* PRESS 2 FOR INTERNATIONAL BOOKING *"<<endl;
cout<<setw(60)<<"* PRESS 3 FOR SEARCH OF FLIGHTS *"<<endl;
cout<<setw(60)<<"* NOW ENTER YOUR CHOICE: *"<<endl;
cout<<setw(60)<<"*************************************"<<endl;
cin>>menu_choice;
system("cls");
passenger* p1;
booking b1;
international i1;
local l1;
char back;
switch(menu_choice)
{
case 1:
p1=&l1;
p1->getdata();
cout<<"To Go To Main Menu Press b"<<endl;
cin>>back;
system("CLS");
if (back=='b')
{
goto m;
}
else
{
cout<<"\n\n\n\n\n\n";
cout<<setw(40)<<"BYE FROM AIR RESERVATION SYSTEM";
}
break;
case 2:
p1=&i1;
p1->getdata();
cout<<"To Go To Main Menu Press b"<<endl;
cin>>back;
system("CLS");
if (back=='b')
{
goto m;
}
else
{
cout<<"\n\n\n\n\n\n";
cout<<setw(40)<<"BYE FROM AIR RESERVATION SYSTEM";
}
break;
case 3:
search s1;
s1.searching();
cout<<"To Go To Main Menu Press b"<<endl;
cin>>back;
system("CLS");
if (back=='b')
{
goto m;
}
else
{
cout<<"\n\n\n\n\n\n";
cout<<setw(40)<<"BYE FROM AIR RESERVATION SYSTEM";
}
break;
}
}
};
int main()
{ SetConsoleTitle("AIRWAYS RESERVATION");
system("color 5f");
cout<<"\n\n\n\n\n\n\n\n\n\n\t\t WELCOME TO AIRWAYS RESERVATION SYSTEM";
Sleep(2500);
system ("cls");
cout<<"\n\n\n\n\n\n\n\t\t Developed by :";
Sleep(500);
cout<<" RANA ARYAN KHAN";
Sleep(500);
cout<<"\n\n\n\t\t USAMA ZAHEER ";
Sleep(3000);
system("cls");
main_menu m1;
m1.getdata();
}
Read More →