You are on page 1of 4

Assignment # I

Course: Object Oriented Programming


Instructor: Dr. Ayesha Salman
Submitted by: Muhammad Fahad Siddiq
Dated: 21st October.2020
ID: BEE-F-150271

Department of Electrical Engineering


Faculty of Engineering
Air University, Islamabad
Airline Reservation System
Airline reservation system will help the administrator to manage various operations related to
flights and passengers. It is a remote application for managing the reservation system. It’s User
friendly (Menu Driven) and easy to use. It would help employees manage the data and work in
much efficient manner. This system simply carries on the idea to do very complex tasks in an
easy way.

Code:

#include<iostream>
using namespace std;
class flight
{
public:
int airplaneNo;
string destination, departDate, departPlace, time, totalSeats, availableSeats;
void setData ()
{
cout << "Enter Air Plane Number:";
cin >> airplaneNo;
cout << "Enter depart Date:";
cin >> departDate;
cout << "Enter depart Place:";
cin >> departPlace;
cout << "Enter time:";
cin >> time;
cout << "Enter
Total seats:"; cin >>
totalSeats;
cout << "Enter available seats:";
cin >> availableSeats;
}
};
class ticket
{
public:
};
class booking
{
public:
int bookingID, bookingStatus;
booking ()
{
bookingStatus = 1;
}
};
class payment
{
public:
bool done;
};
class luggage
{
public:
int weight;
};
class passenger : public booking ,public ticket, public payment, public
luggage {
public:
int passport, airplaneNoPass;
string name, nic, age, gender;
};
int limit = 30;
int main ()
{
int z = 0, choice, i, tempID;
flight arr[10];
passenger obj1;
while (choice !=10)
{
cout << "Enter 1 to put flight data in:";
cout << "Enter 2 to book a ticket:";
cout << "Enter 10 to quit:";
cin >> choice;
if (choice == 1)
{

arr[z].setData ();
z++;
}
if (choice == 2)
{
cout << "Following are the flights\n";
for (i=0;i<z;i++)
{
arr[i].getData ();
}
cout << "Enter Air plance no to book a seat:";
cin >> tempID;
for (i=0;i<z;i++)
{
if (arr[i].airplaneNo == tempID)
{
if (arr[i].availableSeats > 0)
{
obj1.airplaneNoPass
= arr[i].airplaneNo;
arr[i].availableSeats --; }

}
}
}
}
}

You might also like