You are on page 1of 9

AIR LINE RESERVATION SYSTEM

#include<iostream>
using namespace std;
class Flight
{
protected:
char flight_name[20];
char toa[20];
char tod[20];
char doj[20];
char start[20];
char dest[20];

public:

void get()
{
cout<<"Enter Flight Name: ";cin>>flight_name;

cout<<"Enter time of departure: ";cin>>tod;


cout<<"Enter Time of Arrival : ";cin>>toa;

cout<<"Enter your date of journey:";cin>>doj;

cout<<"Starting from: ";cin>>start;

cout<<"Enter Destination: ";cin>>dest;

}
void put()
{
cout<<"Flight Name Is: "<<flight_name<<endl;

cout<<" Time of depart Is: "<<tod<<endl;

cout<<"Time of Arrival Is: "<<toa<<endl;

cout<<"Date of Journey Is: "<<doj<<endl;

cout<<"Starting from: "<<start<<endl;

cout<<"Enter Destination: "<<dest<<endl;

}
virtual void flight()=0;
};

class Payment
{
protected:
long int choice,bank,card,cvv,user_id;
char password[8],date[10];

public:
void pay_details()
{
cout<<"\n\n\nHow would you like to pay?\n"<<endl;

cout<<"\n 1.Debit card \n 2.Credit card \n 3.Net banking"<<endl;

cout<<"\n\nEnter your choice :";

cin>>choice;

switch(choice)
{
case 1:
cout<<"Enter card no :"<<endl;
cin>>card;
cout<<"Enter your cvv"<<endl;
cin>>cvv;
cout<<"Enter expiry date"<<endl;
cin>>date;
cout<<"\nTRANSACTION SUCCESSFUL\n";
break;

case 2:
cout<<"Enter card no :"<<endl;
cin>>card;
cout<<"Enter your password"<<endl;
cin>>password;
cout<<"Enter expiry date"<<endl;
cin>>date;
cout<<"\nTRANSACTION SUCCESSFUL\n";
break;

case 3:
cout<<"Banks available: \n\n 1.HBL bank \n 2.Alfalah bank\n
3.Allied bank \n"<<endl;
cout<<"Select your bank: "<<endl;

cout<<endl;
cin>>bank;
cout<<"You have selected: "<<bank<<endl;
cout<<endl;

cout<<"Enter user id"<<endl;


cin>>user_id;
cout<<"Enter password"<<endl;
cin>>password;
cout<<endl;
cout<<"TRANSACTION SUCCESSFUL"<<endl;
cout<<endl;
break;

default:
cout<<"WRONG INPUT ENTERED\nTRY AGAIN!\n\n";
return pay_details();
}
}
};

class Passenger:public Flight,public Payment


{
protected:
char name[20];
char cnic[20];
char passport[20];
int seat;
public:
void get()
{ Flight::get();

cout<<"Enter your Name: "<<endl;


cin>>name;

cout<<"Enter your CNIC: "<<endl;cin>>cnic;

cout<<"Enter your Passport: "<<endl;cin>>passport;

cout<<"Enter your No. of seats:"<<endl;cin>>seat;

}
void put()
{ Flight::put();
cout<<"Name Is: "<<name<<endl;

cout<<"CNIC Is: "<<cnic<<endl;

cout<<"Passport Is: "<<passport<<endl;


cout<<"No. of seats: "<<seat<<endl;

}
void flight()
{
}
};
int main()
{
cout<<"\n:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"<<endl;
cout<<endl;
cout << "\t WELCOME TO LAMKINS & PYTHON AIRLINE
RESERVATION SYSTEM \n";
cout<<endl;
cout<<":::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"<<endl;
cout<<endl;
char c;
Passenger p1[5];
int x,i=0;
do{
x=0;
cout<<"Please Enter Flight status and Information: "<<endl;
cout<<endl;
p1[i].get();
p1[i].pay_details();

cout<<"Do you want to cancel the flight?(y/n): ";

cin>>c;
if(c=='Y' || c=='y' )
{
cout<<endl;

p1[i].put();
cout<<endl;
cout<<"\n:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"<<endl;
cout<<endl;
cout<<"YOUR FLIGHT HAS BEEN CANCELLED \nAND YOUR FUNDS
ARE NON-REFUNDABLE";
cout<<"\n:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"<<endl;
cout<<endl;

}
else
{

cout<<"\nDisplaying the Ticket Info: "<<endl;


cout<<"\n........................................."<<endl;
p1[i].put();
cout<<".........................................\n"<<endl;

cout<<"\n:::::::::::::::::::::::::::::::::::::::::"<<endl;
cout<<"THANKS FOR USING OUR SERVICE \nYOUR FLIGHT HAS BEEN
BOOKED!!";
cout<<"\n:::::::::::::::::::::::::::::::::::::::::"<<endl;

}
cout<<"\n\nWould you like to reserve the seats again(1/0)\n";
cin>>x;
}
while(x!=0);
}

You might also like