You are on page 1of 20

Mini Project

Of
OOD
P
On
Airline Reservation
System
By : Manan Batra (013)
Snehansu Nag (011)
Airline Reservation System
Airline reservation systems (ARS) are systems that allow an airline to
sell their inventory (seats). It contains information on schedules and
fares and contains a database of reservations (or passenger name
records) and of tickets issued (if applicable). ARSs are part of passenger
service systems (PSS), which are applications supporting the direct
contact with the passenger.

ARS eventually evolved into the computer reservations system (CRS). A


computer reservation system is used for the reservations of a particular
airline and interfaces with a global distribution system (GDS) which
supports travel agencies and other distribution channels in making
reservations for most major airlines in a single system.
Airline Reservation System using
C++
Code
#include <iostream>
#include <string>

const int MAX_SEATS = 100;

struct Flight
{
std::string flightNumber;
int seats[MAX_SEATS];
int numberOfSeats;
};
void initFlight(Flight &f, std::string flightNumber)
{
f.flightNumber = flightNumber;
for (int i = 0; i < MAX_SEATS; i+
+)
{
f.seats[i] = 0;
}
f.numberOfSeats = 0;
}

void displayFlight(const Flight &f)


{
std::cout << "Flight number: " << f.flightNumber << std::endl;
std::cout << "Number of seats: " << f.numberOfSeats << std::endl;
std::cout << "List of seats:" << std::endl;
for (int i = 0; i < f.numberOfSeats; i++)
{
std::cout << i + 1 << ". " << f.seats[i] << std::endl;
}
}

void reserveSeat(Flight &f, int seatNumber)


{
if (f.numberOfSeats < MAX_SEATS)
{
f.seats[f.numberOfSeats] =
seatNumber; f.numberOfSeats++;
std::cout << "Seat reserved successfully!" << std::endl;
}
else
{
std::cout << "No seats available!" << std::endl;
}
}
int main()
{
Flight flight;
initFlight(flight, "AI202");

while (true)
{
std::cout << "1. Display flight information" << std::endl;
std::cout << "2. Reserve a seat" << std::endl;
std::cout << "3. Exit" << std::endl;
std::cout << "Enter your choice:
";

int choice;
std::cin >> choice;

if (choice == 1)
{
displayFlight(flight);
}
else if (choice == 2)
{
int seatNumber;
std::cout << "Enter seat number:
"; std::cin >> seatNumber;
reserveSeat(flight, seatNumber);
}
else if (choice == 3)
{
break;
}
else
{
std::cout << "Invalid choice!" << std::endl;
}
}

return 0;
}
This program creates a struct named Flight to represent a flight, which
has a flight number, a list of seat numbers, and the number of seats.
The initFlight function is used to initialize a flight with the flight
number and an empty list of seats. The displayFlight function displays
the flight information, including the flight number and the list of seats.
The reserveSeat function reserves a seat by adding the seat number to
the list of seats.
In the main function, a flight is initialized with the flight
Output
As you can see, the program allows the user to display flight information, reserve a seat, or exit the program.
Use Case Model
The main actor in the system is the Customer, who interacts with the
Airline Reservation System to book a flight. The system uses the Flight
entity to represent the available flights and manage the customer's
bookings.
In this diagram, the customer uses the Airline Reservation System to
book a flight, and the system interacts with the Flight entity to manage
the booking. The solid line with an arrowhead pointing from the
Customer to the Airline Reservation System represents the use case.
The solid line with an arrowhead pointing from the Airline Reservation
System to the Flight represents the relationship between the system
and the Flight entity.
Class Diagram
The class diagram represents the classes, their attributes, and their
relationships. The classes are Customer, Flight, and Reservation.
The Customer class has attributes such as name, address, and phone number.
The Flight class has attributes such as flight number, seats, and number of
seats. The Reservation class has attributes such as customer, flight, and seat
number.
The arrows between the classes represent the relationships between them. The
arrow between the Customer and Reservation classes represents an association,
indicating that a Customer can make one or more Reservations. The arrow
between the Flight and Reservation classes represents another association,
indicating that a Flight can have one or more Reservations. The diamond symbol
on the Reservation class's side of the association represents aggregation,
indicating that a Reservation is a part of a Flight and a Customer

You might also like