0% found this document useful (0 votes)
100 views

Assignment # I: Dated: 21 October.2020

This document contains code for an airline reservation system with the following key classes: 1. Flight class to store flight details like number, destination, date etc. 2. Ticket, booking, payment and luggage classes to manage ticket booking details. 3. Passenger class that inherits from booking, ticket, payment and luggage to store passenger details. 4. Main function includes a menu to allow admin to add flight details or book tickets, and code to search for available seats on a flight when booking.

Uploaded by

Fahad Siddiq
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
100 views

Assignment # I: Dated: 21 October.2020

This document contains code for an airline reservation system with the following key classes: 1. Flight class to store flight details like number, destination, date etc. 2. Ticket, booking, payment and luggage classes to manage ticket booking details. 3. Passenger class that inherits from booking, ticket, payment and luggage to store passenger details. 4. Main function includes a menu to allow admin to add flight details or book tickets, and code to search for available seats on a flight when booking.

Uploaded by

Fahad Siddiq
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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