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

CS PROJECT (Flight management System)2

Uploaded by

arjunkuttikkat1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
126 views

CS PROJECT (Flight management System)2

Uploaded by

arjunkuttikkat1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

FLIGHT MANAGEMENT

SYSTEM

Name: Arjun K
Class: XII F
Roll No: 14
School: Devamatha CMI Public School
Year: 2024-25

pg. 1
ACKNOWLEDGEMENT
I would like to extend my heartfelt gratitude to the Almighty
for bestowing upon me the wisdom, determination, and
opportunity to embark on this journey of creating a computer
project. Without this divine guidance, the path would have
been much more challenging. My deepest thanks go to our
esteemed Principal, whose unwavering support and
encouragement have been instrumental in turning this project
into a reality. Their belief in the potential of their students and
their dedication to fostering an environment conducive to
learning have been truly inspiring.
I am profoundly appreciative of Mr. Srinath O., my Computer
Science teacher, whose exceptional guidance and expertise
have been invaluable throughout the development of this
project. His commitment to nurturing my technical skills and
providing insightful feedback has significantly contributed to
my growth and the project's success. Mr. Srinath's
encouragement and support have been a driving force in
overcoming challenges and achieving the project's goals.
I also want to acknowledge the vital role played by my
collaborators, Evin and Joseph. Their contributions and
collaborative spirit have been crucial to the project's
completion, and working with them has been both productive
and rewarding. Furthermore, I am deeply grateful to my
parents for their constant support, sacrifices, and unwavering
belief in my abilities. Their encouragement and love have
been the bedrock of my achievements, and I am truly blessed
to have them by my side.

pg. 2
CONTENTS
SL.NO. TITLE PAGE NO.
1 OBJECTIVE & 4
SCOPE
2 SYSTEM 5
REQUIREMENTS
I)HARDWARE
II)SOFTWARE
3 INTRODUCTION 6
TO PYTHON
4 DESIGN OF THE 8
PROGRAM
I)VARIABLES USED
I)MODULES USED
II) FUNCTIONS
USED
III)FILES USED
5 PROGRAM CODE 12
6 SAMPLE OUTPUTS 17
7 CONCLUSION 20
8 BIBLIOGRAPHY 21

pg. 3
OBJECTIVE AND SCOPE
Our objective is to develop a robust software
solution that showcases our proficiency in
programming while addressing key challenges in
aviation management. This project aims to
leverage our knowledge in data structures, user
interface design, and data management to improve
our problem-solving and programming
capabilities.
We plan to create a comprehensive system that
enables users to efficiently manage flight records,
including functionalities for adding, viewing,
updating, and deleting flight information. The
scope of our project will encompass features such
as secure user authentication, intuitive and
accessible user interfaces, and essential security
protocols to safeguard data.
Through this initiative, we aspire to deepen our
understanding of computer science principles
while delivering a practical and user-friendly
Flight Management System. The project will be
accompanied by detailed documentation to ensure
clarity and usability.

pg. 4
SYSTEM REQUIREMENTS

HARDWARE:

Device Name: GIGABYTE


Processor: 12th Gen Intel(R) Core (TM) i7-12700K
Processor speed: 3.60 GHz
RAM: 16GB

SOFTWARE:

Operating System: Windows 11 Pro


IDE: Python IDLE 3.12

pg. 5
INTRODUCTION TO PYTHON

Python is a powerful and adaptable programming


language that has become a fundamental tool in
contemporary software development. Celebrated for its
straightforward syntax and readability, Python has won
the favour of developers globally. Designed by Guido
van Rossum and introduced in 1991, Python
emphasizes clarity and ease of use, making it an
attractive choice for many.
Over time, Python has grown into a versatile language
used across a wide range of fields, including web
development, data science, scientific research, and
artificial intelligence. One of Python’s notable features
is its dynamic typing, which eliminates the need for
developers to explicitly declare variable types,
streamlining the coding process. As an open-source
language, Python is praised for its elegant and efficient
code, often achieving results with fewer lines.
Python's extensive library ecosystem further enhances
its utility, offering a vast array of modules and
frameworks that simplify complex tasks. Libraries such
as NumPy and Pandas make data manipulation
straightforward, while frameworks like Django and
Flask streamline web development. Additionally,

pg. 6
Python’s strong community support ensures continuous
improvements and a wealth of resources for learning
and problem-solving, making it a reliable choice for
both novice and experienced developers.
In an era where technology is rapidly evolving, Python's
flexibility and broad application range position it as a
key player in shaping future innovations. Its role in
emerging fields like machine learning and automation
highlights its relevance and enduring appeal. Whether
for developing robust applications, analysing large
datasets, or experimenting with cutting-edge
technologies, Python stands out as a versatile and
dynamic tool that meets the demands of modern
software development

pg. 7
Design of the program
MODULES USED:

TYPE USE
CSV Used for reading
from and writing CSV
files. It provides
functions for working
with CSV data
tabulate Used for formatting
and displaying flight
data in a tabular
format.
datetime Used for parsing and
formatting date and
time values in flight
records.

pg. 8
FUNCTIONS USED
TYPE USE PARAMETER RETURN
Read_ fight_ Reads flight data `filename (str)` -The List of flight
from a CSV file
data(filename) and returns it as
name of the CSV file records (list of
a list of to read. dicts).
dictionaries.
Write_flight_data Writes flight Filename(str)-the None
(filename, flights) data to a CSV name of the CSV file
file to write to, flights
(list)- The list of flight
records.
Display_flights_ Displays `flights (list)` -The list None
table(flights) flight data in of flight records to
a tabular display.
format using
the tabulate
module.
Add_ flight(flights) Adds a new `Flights` (list) -The None
flight record list of flight records.
to the flights
list
Update_ flight(flights, Flight record `Flight` (str)- The ID None
flight id, new_flight_ in the of the flight to
data) `flights` list update, `new flight
data` (dict) -The
updated flight data.
Delete_flight (flights, Deletes a `Flights` (list)- The None
fight id) flight record list of flight records,
from the `flight id` (str)-The ID
flights list. of the flight to
delete.
Search_flight(flights) Searches for a flights None
flight by flight
ID or model
(list) - The list
and displays of flight records to
the results. search through

pg. 9
VARIABLES USED
TYPE DATA TYPE USE

CSV_FILENAME str Stores the filename of


the CSV file used to
store flight data.

CSV_ FIELDNAMES list Stores the field


names/column headers
for the CSV file.

flights list Stores a list of flight


records, where each
flight record is
represented as a
dictionary.

headers headers Stores the headers for


displaying flight data in a
tabular format.

Fight_data list Stores flight data in


tabular format (list of
lists) for use with the
tabulate` module.

search_term str Stores the input


provided by the user for
searching a flight by
Flight ID.

pg. 10
FILES USED

NAME USE
Flights.csv For storing sample data

pg. 11
Program CODE
import csv
from tabulate import tabulate
from datetime import datetime

# Constants for CSV filename and fieldnames


CSV_FILENAME = "lights.csv"
CSV_FIELDNAMES = ['flight_id', 'model', 'arrival_time',
'arrival_location', 'departure_time',
'departure_location',
'passengers']

# Function to read flight data from the CSV file


def read_flight_data(filename):
flights = []
try:
with open(filename, 'r') as file:
csv_reader = csv.DictReader(file)
for row in csv_reader:
flights.append(row)
except FileNotFoundError:
print(f"File {filename} not found. Creating a
new file...")
return flights

# Function to write flight data to the CSV file


def write_flight_data(filename, flights):
with open(filename, 'w', newline="") as file:
csv_writer = csv.DictWriter(file,
fieldnames=CSV_FIELDNAMES)
csv_writer.writeheader()
csv_writer.writerows(flights)

# Function to display flight details in a tabular


format
def display_flights_table(flights):
if not flights:
print("No flights available.")
return
headers = ["Flight ID", "Model", "Arrival Time",
"Arrival Location", "Departure Time", "Departure
Location",

pg. 12
"Passengers"]
flight_data = []
for flight in flights:
flight_info = [
flight['flight_id'],
flight['model'],
flight['arrival_time'],
flight['arrival_location'],
flight['departure_time'],
flight['departure_location'],
flight['passengers']
]
flight_data.append(flight_info)
print(tabulate(flight_data, headers,
tablefmt="fancy_grid"))

# Function to add a new flight


def add_flight(flights):
flight_id = input("Enter Flight ID: ")
model = input("Enter Model: ")
arrival_time = input("Enter Arrival Time (YYYY-MM-
DD HH:MM:SS): ")
arrival_location = input("Enter Arrival Location:
")
departure_time = input("Enter Departure Time (YYYY-
MM-DD HH:MM:SS): ")
departure_location = input("Enter Departure
Location: ")
passengers = input("Enter Number of Passengers: ")

flight = {
'flight_id': flight_id,
'model': model,
'arrival_time': arrival_time,
'arrival_location': arrival_location,
'departure_time': departure_time,
'departure_location': departure_location,
'passengers': passengers
}
flights.append(flight)
print("Flight added successfully!")

# Function to update a flight record


def update_flight(flights, flight_id, new_flight_data):
for flight in flights:

pg. 13
if flight['flight_id'] == flight_id:
flight.update(new_flight_data)
return True
return False

# Function to delete a flight


def delete_flight(flights, flight_id):
flights[:] = [flight for flight in flights if
flight['flight_id'] != flight_id]
print("Flight deleted successfully!")

# Function to search for a flight by flight ID or model


def search_flight(flights):
search_term = input("Enter Flight ID or Model to
search: ")
found_flights = [flight for flight in flights if
flight['flight_id'] == search_term or flight['model']
== search_term]

if found_flights:
print("\nSearch Results:")
display_flights_table(found_flights)
else:
print("No flights found with the provided
Flight ID or Model.")

if __name__ == "__main__":
# Load flight data from the CSV file
flights = read_flight_data(CSV_FILENAME)

while True:
print("\nFlight Management System")
print("1. View All Flights")
print("2. Add a New Flight")
print("3. Update a Flight")
print("4. Delete a Flight")
print("5. Search for a Flight")
print("6. Exit")

choice = input("Enter your choice: ")

if choice == '1':
display_flights_table(flights)

elif choice == '2':

pg. 14
add_flight(flights)
write_flight_data(CSV_FILENAME, flights)

elif choice == '3':


flight_id = input("Enter Flight ID to
update: ")
for flight in flights:
if flight['flight_id'] == flight_id:
new_model = input("Enter new Model:
")
new_arrival_time = input("Enter new
Arrival Time (YYYY-MM-DD HH:MM:SS): ")
new_arrival_location = input("Enter
new Arrival Location: ")
new_departure_time = input("Enter
new Departure Time (YYYY-MM-DD HH:MM:SS): ")
new_departure_location =
input("Enter new Departure Location: ")
new_passengers = input("Enter new
Number of Passengers: ")
new_flight_data = {
'model': new_model,
'arrival_time':
new_arrival_time,
'arrival_location':
new_arrival_location,
'departure_time':
new_departure_time,
'departure_location':
new_departure_location,
'passengers': new_passengers
}
if update_flight(flights,
flight_id, new_flight_data):
write_flight_data(CSV_FILENAME,
flights)
print("Flight updated
successfully!")
else:
print("Flight not found.")
break

elif choice == '4':


flight_id = input("Enter Flight ID to
delete: ")

pg. 15
delete_flight(flights, flight_id)
write_flight_data(CSV_FILENAME, flights)

elif choice == '5':


search_flight(flights)

elif choice == '6':


print("Exiting the Flight Management
System.")
break

else:
print("Invalid choice. Please enter a valid
option.")

pg. 16
SAMPLE OUTPUTS
ADDING FLIGHT

VIEWING FLIGHTS

pg. 17
UPDATING FLIGHTS

SEARCHING FLIGHTS

pg. 18
DELETING FLIGHTS

pg. 19
CONCLUSION
In conclusion, this Python file handling project has
provided valuable insights into efficiently
managing and manipulating data stored in files.
We have covered various file operations, including
reading, writing, appending, and creating
directories, which have allowed us to understand
how Python handles different aspects of file
management. By working through these processes,
we've gained practical experience that has
enhanced our understanding of Python's powerful
file handling features.
As we wrap up this project, it is clear that the skills
acquired are not only relevant but also versatile,
applicable to a wide range of real-world scenarios.
Whether building data processing workflows,
automating tasks, or designing user-friendly file
management systems, the knowledge gained from
this project can be leveraged in many applications.
Python's ease of use and robustness in handling
files makes it a valuable tool for developing
efficient and effective data management solutions.

pg. 20
BIBLIOGRAPHY
• Python Software Foundation. (2023). Python Documentation: Input and
Output. Retrieved from
https://docs.python.org/3/tutorial/inputoutput.html
• Sweigart, A. (2019). Automate the Boring Stuff with Python: Practical
Programming for Total Beginners. 2nd Edition. No Starch Press.
• Real Python Team. (2022). Working with Files in Python. Real Python.
Retrieved from https://realpython.com/read-write-files-python/
• Beazley, D., & Jones, B. (2013). Python Cookbook: Recipes for Mastering
Python 3. 3rd Edition. O'Reilly Media
• Zelle, J. (2004). Python Programming: An Introduction to Computer
Science. Franklin, Beedle & Associates Inc.
• W3Schools. (2022). Python File Handling. Retrieved from
https://www.w3schools.com/python/python_file_handling.asp
• GeeksforGeeks. (2021). File Handling in Python. GeeksforGeeks.
Retrieved from https://www.geeksforgeeks.org/file-handling-python/
• Hetland, M. L. (2005). Beginning Python: From Novice to Professional.
Après.

pg. 21

You might also like