DSA Theory Project
Presented to:
Sir Ahmar Rashid
Presented by:
Hamza Iftikhar (2023424)
Airline Reservation System Report
Overview
The Airline Reservation System is my project implemented using C++ with a focus
on fundamental data structures such as linked lists,stacks,queues,maps,trees. The
system allows users to perform various operations related to flight and passenger
management, ensuring compliance with the requirements outlined in the provided
project documents.
Features Implemented
The system supports the following functionalities:
Flight Management
Show All Cities Serviced by the Airline:
1. Displays a list of all unique cities serviced by the airline.
2. Cities are extracted from the flight schedule without duplication.
2.
Show Flight Departures for a City:
Lists all flights departing from a specified city, including details such as:
1. Flight Number
2. Departure Time
3. Arrival City
4. Arrival Time
Show Flight Arrivals for a City:
Lists all flights arriving at a specified city, formatted similarly to departures.
Show Cities Reachable from a Specific City:
1. Displays all unique cities directly reachable from a given city.
2. Helps users identify potential travel routes.
Find the Shortest Path Between Two Cities:
1. Uses a manual breadth-first search (BFS) algorithm to determine the shortest path
based on direct connections.
2. Outputs the sequence of cities in the shortest path.
Passenger Management
Make a Reservation:
1. Allows users to reserve a flight for a passenger.
2. Includes input for passenger’s first name, last name, and flight number.
3. Validates the flight’s existence before creating the reservation.
1.
Display a Passenger’s Reservation Schedule:
2.
1. Retrieves and displays all reservations made by a specific passenger.
3.
Delete a Reservation:
4.
1. Removes a passenger’s reservation from the system based on their first and last
name.
Data Management
Linked List Implementation:
o Flights and passengers are stored using linked lists, ensuring efficient dynamic
memory allocation and traversal.
Code Structure
Core Components
1.
FlightNode Struct:
2.
o Represents a single flight with details such as flight number, departure city, arrival
city, and timings.
o Includes a pointer to the next flight node, enabling linked list traversal.
3.
PassengerNode Struct:
4.
o Represents a passenger’s reservation with their name and flight number.
o Includes a pointer to the next passenger node.
Key Functions
1.
Flight Operations:
o addFlight: Adds a new flight to the flight schedule.
o showCities: Displays all unique cities serviced by the airline.
o showDepartures: Lists all flights departing from a specified city.
o showArrivals: Lists all flights arriving at a specified city.
o showReachableCities: Lists all reachable cities from a given city.
o shortestPath: Finds the shortest path between two cities using BFS.
Passenger Operations:
o addPassenger: Adds a new reservation to the passenger list.
o makeReservation: Creates a reservation after validating flight availability.
o displayPassengerSchedule: Retrieves a passenger’s reservations.
o deleteReservation: Deletes a reservation by passenger name.
Utility Functions:
o cityExists: Checks if a city exists in a vector.
Menu System
The main menu allows users to interact with the system via options to:
Manage flights.
Handle passenger reservations.
Query flight and passenger details.
Testing and Demonstration
The system includes preloaded data for demonstration:
Flights:
o Flight F101 from CityA to CityB.
o Flight F102 from CityB to CityC.
o Flight F103 from CityA to CityD.
1.
Passengers:
o abc on Flight F101.
o efg Smith on Flight F102.
Example Scenarios
Shortest Path:
o Query the shortest path between CityA and CityC.
o Output: "CityA CityB CityC"
Reservation Creation:
o Add a reservation for xyz on Flight F103.
o Confirmation: "Reservation made successfully for xyz on flight F103."
Passenger Schedule:
o Display abc (passenger) schedule.
o Output: "Passenger abc is reserved on flight F101."
Delete Reservation:
o Remove efg reservation.
o Confirmation: "Reservation for efg has been deleted."
Limitations
The system assumes unique flight numbers.
No graphical user interface (GUI); interaction is through the command line.
Does not handle round-trip reservations as a distinct operation.
Conclusion
The Airline Reservation System meets the functional requirements outlined in our
project requirements. It efficiently handles flight and passenger data using linked lists,
providing a foundation for further enhancements such as advanced search algorithms
or a GUI-based interface.