0% found this document useful (0 votes)
1K views35 pages

Flight Management System - CS Project

The Flight Management System project, developed using Python and MySQL, aims to optimize flight management by providing accurate flight information and comprehensive reports. It includes features such as flight status checks by date or airline, and administrative functions for inserting, updating, and deleting flight details. The project emphasizes the importance of system specifications and the use of external libraries for effective database connectivity and functionality.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views35 pages

Flight Management System - CS Project

The Flight Management System project, developed using Python and MySQL, aims to optimize flight management by providing accurate flight information and comprehensive reports. It includes features such as flight status checks by date or airline, and administrative functions for inserting, updating, and deleting flight details. The project emphasizes the importance of system specifications and the use of external libraries for effective database connectivity and functionality.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 35

FLIGHT MANAGE

Class 12th Project – Computer Science

Mohini Chauhan Year 2024 Python/MySQL Project


INDEX

1. Certificate

2. Acknowledgment

3. Introduction/Overview of the Project

4. System Specification : Hardware and Software

5. Database Design

6. Modules and Functions

7. Source Code

8. Output

9. Conclusion

10. Bibliography / Reference

Page 1 of 35
Page 2 of 35
ACKNOWLEDGEMENT
I would like to express my sincere gratitude to everyone who contributed to the success of
this Python project. Their support, expertise, and encouragement were instrumental in
making this endeavour a reality.

I extend my deepest appreciation to Mr. Deepak Pithadia, whose guidance and mentorship
played a crucial role in shaping the project and pushing it to new heights. Your invaluable
insights and commitment to excellence have been truly inspiring.

Additionally, I appreciate the open-source community and the authors of the libraries and
frameworks used in this project. Their collective efforts have paved the way for efficient
development and have been instrumental in the project's functionality.

Thank you to everyone who played a part, directly or indirectly, in bringing this Python
project to fruition.

Sincerely,

Mohini Krunalsinh Chauhan


[Date]

Page 3 of 35
PROJECT OVERVIEW

Flight Management System is a Software solution designed to streamline and optimize

management of Flights. This project uses state – of - the - art language which are Python and

MYSQL, one of the finest database connectivity tools available in the market today. This

software code provides basic but accurate information of the flights with various details.

The key features of this project are :

1) Usage of Python :

Python's versatility and readability makes it ideal for web development, data

analysis, machine learning, artificial intelligence, automation, and more.

2) Usage of MySQL :

MySQL is a powerful relational database management system used for storing,

managing, and retrieving structured data in various applications.

3) Reports and Analytics

This project provides comprehensive reports on arrival and departure of flights on

the click of a button as per the user input.

Page 4 of 35
SYSTEM SPECIFICATION
SOFTWARE AND HARDWARE

For optimal performance of Python and MySQL software, a system with a modern processor

(e.g., Intel Core i5 or equivalent), 8GB RAM, and sufficient storage (256GB SSD or higher) is

recommended. Install the latest versions of Python and MySQL, ensuring compatibility with

the operating system. Adequate bandwidth for internet connectivity is essential for updates

and seamless MySQL database interactions. Additionally, consider using a virtual

environment for Python projects and employing indexing and caching mechanisms in MySQL

for enhanced database performance. Regularly update system components, libraries, and

security patches to maintain stability and security in both Python and MySQL environments.

Page 5 of 35
DATABASE DESIGN

Page 6 of 35
BRIEF INTRODUCTION ABOUT

MODULES

1. mysql.connector

a. This module is used for connecting to a MySQL database from Python. It


provides functionality for establishing the connection, executing SQL queries,
fetching results, and managing transactions.
b. Specific usage in the code includes creating a connection object (mydb) and
using a cursor (mydb.cursor()) to execute SQL queries.

These are the external modules in the provided code. Other aspects, such as loops,
conditionals, and function definitions, use Python's built-in functionality.

Page 7 of 35
CODING

import mysql.connector

mydb = mysql.connector.connect(
host="localhost",
user="root",
password="aviation101",
database='flight_management_system')

print(mydb)
print('Connection Established!')

#Defining Functions.
def display_menu1():
print('\nMENU : ')
print('+--------------------------+')
print('| PLEASE ENTER YOUR CHOICE |')
print('+--------------------------+')
print('| 1. ARRIVALS |')
print('| 2. DEPARTURES |')
print('| 3. ADMINISTRATION |')
print('| 4. EXIT MENU |')
print('+--------------------------+')
def print_flight_status_menu():
print('+------------------------------------------------+')
print('| PLEASE ENTER YOUR SUB CHOICE |')
print('+------------------------------------------------+')
print('| 1. Check your flight status by date. |')
print('| 2. Check your flight status by airline. |')
print('| 3. Exit. |')
print('+------------------------------------------------+')

def display_menu2():
print('+-------------------------------------------+')
print('| PLEASE MAKE YOUR CHOICE |')
print('+-------------------------------------------+')
print('| 1. Check your flight status by date. |')
print('| 2. Check your flight status by airline. |')
print('| 3. Exit. |')
print('+-------------------------------------------+')

def display_menu3():
print('+-------------------------------------------------------+')

Page 8 of 35
print('| PLEASE SELECT ADMINISTRATION OPTION |')
print('+-------------------------------------------------------+')
print('| 1. INSERT FLIGHT DETAILS |')
print('| 2. UPDATE FLIGHT DETAILS |')
print('| 3. DELETE FLIGHT DETAILS |')
print('| 4. Exit. |')
print('+-------------------------------------------------------+')

#Heading for menu-driven approach.


print('*******************************************')
print(' WELCOME TO THE FLIGHT MANAGEMENT SYSTEM!')
print('*******************************************')

#Using while loop to print the menu list.

while True:
display_menu1() #Calling the function.

passenger_choice = int(input('Enter your choice : '))

if passenger_choice == 1:
while True:
print_flight_status_menu() #Calling the function.

choice1 = int(input('Enter your choice : '))

# Calling the relevant method based on users choice using if-else loop.

if choice1 == 1:
print('============================== \n')
print('Your Arrival Flight Status By Date :- ')
print('============================== \n')
mycursor = mydb.cursor()
mycursor.execute("SELECT FlightName as 'Flight Name', FlightID as 'Flight ID',
AirlinesName as 'Airlines "
"Name',AircraftType as 'Aircraft Type',ArrivalOrDeparture 'Arrival or
Departure',"
"ScheduledTime as 'Scheduled Time',ExpectedTime as 'Expected
Time',FlightStatus as 'Flight "
"Status',OriginName as 'Origin',DestinationName as 'Destination' FROM
flightstatus where "
"ArrivalOrDeparture='Arrival' order by ScheduledTime")
myresult = mycursor.fetchall()

for x in myresult:

Page 9 of 35
print(x)

elif choice1 == 2:
print('============================== \n')
print('Your Arrival Flight Status By Airlines : ')
print('============================== \n')
mycursor = mydb.cursor()
mycursor.execute("SELECT FlightName as 'Flight Name', FlightID as 'Flight ID',
AirlinesName as 'Airlines "
"Name',AircraftType as 'Aircraft Type',ArrivalOrDeparture 'Arrival or
Departure',"
"ScheduledTime as 'Scheduled Time',ExpectedTime as 'Expected
Time',FlightStatus as 'Flight "
"Status',OriginName as 'Origin',DestinationName as 'Destination' FROM
flightstatus where "
"ArrivalOrDeparture='Arrival' order by AirlinesName")
myresult = mycursor.fetchall()

for x in myresult:
print(x)

elif choice1 == 3:

break
else:
print('Invalid choice. Please try again!')
elif passenger_choice == 2:
while True:

display_menu2()

choice1 = int(input('Enter your choice : '))


if choice1 == 1:
print('============================== \n')
print('Your Departure Flight Status By Date : ')
print('============================== \n')
mycursor = mydb.cursor()
mycursor.execute("SELECT FlightName as 'Flight Name', FlightID as 'Flight ID',
AirlinesName as 'Airlines "
"Name',AircraftType as 'Aircraft Type',ArrivalOrDeparture 'Arrival or
Departure',"
"ScheduledTime as 'Scheduled Time',ExpectedTime as 'Expected
Time',FlightStatus as 'Flight "
"Status',OriginName as 'Origin',DestinationName as 'Destination' FROM
flightstatus where "
"ArrivalOrDeparture='Departure' order by ScheduledTime")

Page 10 of 35
myresult = mycursor.fetchall()

for x in myresult:
print(x)

elif choice1 == 2:
print('============================== \n')
print('Your Departure Flight Status By Airlines : ')
print('============================== \n')
mycursor = mydb.cursor()
mycursor.execute("SELECT FlightName as 'Flight Name', FlightID as 'Flight ID',
AirlinesName as 'Airlines "
"Name',AircraftType as 'Aircraft Type',ArrivalOrDeparture 'Arrival or
Departure',"
"ScheduledTime as 'Scheduled Time',ExpectedTime as 'Expected
Time',FlightStatus as 'Flight "
"Status',OriginName as 'Origin',DestinationName as 'Destination' FROM
flightstatus where "
"ArrivalOrDeparture='Departure' order by AirlinesName")
myresult = mycursor.fetchall()

for x in myresult:
print(x)
elif choice1 == 3:

break
else:
print('Invalid choice. Please try again!')
elif passenger_choice == 3:

# Menu 3 for Administration will be displayed

display_menu3()

choice1 = int(input('Enter your choice : '))


if choice1 == 1:
#Code to Insert Flight details will be executed as below

print('============================== ')
print('ENTER FLIGHT DETAILS : ')
print('============================== \n')
flCode = int(input('Enter Flight Code (In Numbers) : '))
flID = int(input('Enter Flight ID (In Numbers) : '))
flame = (input('Enter Flight Name : '))
ArID = int(input('Enter AirLine ID (In Numbers) : '))
ArName = (input('Enter AirLine Name : '))
ArType = (input('Enter Aircraft Type (Cargo or Passenger) : '))

Page 11 of 35
AOrD = (input('Arrival or Departure : '))
ScheduleTime = (input('Enter Flight Scheduled Time : '))
ExpectedTime = (input('Enter Flight Expected Time : '))
FlightStatus = (input('Enter Flight Status (ON TIME or DELAYED) : '))
OriginName = (input('Enter Flight Origin Name : '))
DestinationName = (input('Enter Destination Name : '))

query = "INSERT INTO FLIGHTSTATUS (FlightCode,FlightID, FlightName, AirlinesID,


AirlinesName, AircraftType, " \
"ArrivalOrDeparture, ScheduledTime, ExpectedTime,FlightStatus, OriginName,
DestinationName) VALUES (" \
"%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"

values = (flCode,flID, flame, ArID, ArName, ArType, AOrD, ScheduleTime,


ExpectedTime, FlightStatus, OriginName,
DestinationName)
cursor = mydb.cursor()
cursor.execute(query, values)
mydb.commit()
print(cursor.rowcount, "\n record(s) inserted.. \n")
display_menu3()

if choice1 == 2:
#Code to Update Flight details will be executed as below

print('============================== ')
print('ENTER FLIGHT CODE TO UPDATE DETAILS : ')
print('============================== \n')
flCode = int(input('Enter Flight Code (In Numbers) : '))

mycursor = mydb.cursor()
mycursor.execute("SELECT FlightName as 'Flight Name', FlightID as 'Flight ID',
AirlinesName as 'Airlines "
"Name',AircraftType as 'Aircraft Type',ArrivalOrDeparture 'Arrival or
Departure',"
"ScheduledTime as 'Scheduled Time',ExpectedTime as 'Expected
Time',FlightStatus as 'Flight "
"Status',OriginName as 'Origin',DestinationName as 'Destination' FROM
flightstatus where "
"Flightcode = %s", (flCode,))

myresult = mycursor.fetchall()

for x in myresult:
print(x)

print('ENTER UPDATED DETAILS FOR FLIGHT : ')

Page 12 of 35
flID = int(input('Enter Flight ID (In Numbers) : '))
flame = (input('Enter Flight Name : '))
ArID = int(input('Enter AirLine ID (In Numbers) : '))
ArName = (input('Enter AirLine Name : '))
ArType = (input('Enter Aircraft Type (Cargo or Passenger) : '))
AOrD = (input('Arrival or Departure : '))
ScheduleTime = (input('Enter Flight Scheduled Time : '))
ExpectedTime = (input('Enter Flight Expected Time : '))
FlightStatus = (input('Enter Flight Status (ON TIME or DELAYED) : '))
OriginName = (input('Enter Flight Origin Name : '))
DestinationName = (input('Enter Destination Name : '))

query1 = """
UPDATE FLIGHTSTATUS
SET FlightID = %s, FlightName = %s, AirlinesID = %s, AirlinesName = %s, AircraftType =
%s,
ArrivalOrDeparture = %s, ScheduledTime = %s, ExpectedTime = %s, FlightStatus =
%s,
OriginName = %s, DestinationName = %s
WHERE FlightCode = %s
"""
values = (flID, flame, ArID, ArName, ArType, AOrD, ScheduleTime, ExpectedTime,
FlightStatus, OriginName, DestinationName, flCode )

with mydb.cursor() as cursor:


cursor.execute(query1, values)
mydb.commit()

if cursor.rowcount > 0:
print(cursor.rowcount, "record(s) updated")
else:
print("No record found with that Flight Code.")

display_menu3()

if choice1 == 3:
#Code to Delete Flight details will be executed as below

print('============================== ')
print('ENTER FLIGHT CODE TO DELETE DETAILS : ')
print('============================== \n')
flCode = int(input('Enter Flight Code (In Numbers) : '))
query = "DELETE FROM FLIGHTSTATUS WHERE FlightCode= %s"

values= (flCode,)
cursor = mydb.cursor()

Page 13 of 35
cursor.execute(query, values)
mydb.commit()
print(cursor.rowcount, "record(s) deleted")
display_menu3()

if choice1 == 4:
#Code to Exit Flight details will be executed as below

print('>>> Returning to previous Menu. <<<')


display_menu1()

else:
print('No details entered.')

break

elif passenger_choice == 4:
print('THANK YOU FOR USING FLIGHT MANAGEMENT SYSTEM!')
break
else:
print('Invalid choice, Please Try Again !')
print()

Page 14 of 35
OUTPUT SCREENSHOTS

MySQL

Page 15 of 35
Page 16 of 35
Page 17 of 35
MySQL – Output

Page 18 of 35
Page 19 of 35
Python

Page 20 of 35
Page 21 of 35
Page 22 of 35
Page 23 of 35
Page 24 of 35
Page 25 of 35
Page 26 of 35
Python - Output

Page 27 of 35
Page 28 of 35
Page 29 of 35
Page 30 of 35
Page 31 of 35
Page 32 of 35
CONCLUSION
In conclusion, this Flight Management System project provides us with the opportunity to
understand Python as a language and the MySQL Database management system and how
these tools help us resolve the real world problems. In this project I learned how to use
various system libraries and various MySQL functions to create, store and display data from
the server to users on a single click of a button within a fraction of a second.

This project also helped me learn how to use internet to search information, decoding and
debugging the python program. This project also provided me with an opportunity to discuss
project related problems with my classmates and search for solutions just like a small team,
which taught me the valuable lesson of being a team player.

Page 33 of 35
BIBLIOGRAPHY
1. Mathplanet :
https://www.mathplanet.com
2. DataCamp :

https://datacamp.com

3. GeeksforGeeks :
https://geeksforgeeks.org

Page 34 of 35

You might also like