CSC - File - Archit - and - Shubh - Recent
CSC - File - Archit - and - Shubh - Recent
CLASS: XII
SESSION: 2024-2025
COMPUTER SCIENCE PROJECT FILE
TOPIC: Flight Management System
1. ACKNOWLEDGEMENT
2. CERTIFICATE
3. HARDWARE AND SOFTWARE
REQUIRED
4. INTRODUCTION OF THE TOPIC
5. SYNOPSIS OF THE PROJECT
6. CODE OF THE PROJECT
7. OUTPUT OF THE PROJECT
8. REFERENCES
ACKNOWLEDGMENT
SIGNATURE
HARDWARE AND SOFTWARE REQUIRED
HARDWARE
1. LAPTOP
2. MOBILE PHONE
SOFTWARE
1. PYTHON (LATEST VERSION)
2. MICROSOFT EXCEL(CSV FILES)
WHAT IS FLIGHT MANAGEMENT SYSTEM
import csv
import os
FILENAME = 'Flight.csv'
def menu():
while True:
print("\nFLIGHT MANAGEMENT SYSTEM")
print("1. Add Records")
print("2. Display Records")
print("3. Modify Records")
print("4. Delete Records")
print("5. Search Records")
print("6. Exit")
choice = input("Enter your choice (1-6): ")
if choice == '1':
add_record()
elif choice == '2':
display_record()
elif choice == '3':
modify_record()
elif choice == '4':
delete_record()
elif choice == '5':
search_record()
elif choice == '6':
print("Exiting program. Goodbye!")
break
else:
print("Invalid choice. Please enter a number
between 1 and 6.")
def add_record():
flight_no = input("Enter flight number: ")
if check_duplicate(flight_no):
print("Flight number already exists. Please enter a
unique flight number.")
return
def check_duplicate(flight_no):
if os.path.exists(FILENAME):
with open(FILENAME, mode='r') as file:
reader = csv.reader(file)
for row in reader:
if row[0] == flight_no:
return True
return False
def display_record():
if not os.path.exists(FILENAME):
print("No records available.")
return
def modify_record():
flight_no = input("Enter flight number to modify: ")
records = []
found = False
if os.path.exists(FILENAME):
with open(FILENAME, mode='r') as file:
reader = csv.reader(file)
for row in reader:
if row[0] == flight_no:
found = True
print("\nCurrent details: Flight Number: %s,
Name: %s, Phone: %s, Email: %s, Departure: %s,
Arrival: %s, Price: %s" % (row[0], row[1], row[2],
row[3], row[4], row[5], row[6]))
confirmation = input("Are you sure you
want to modify this record? (y/n): ").lower()
if confirmation == 'y':
name = input("New passenger name
(leave blank to keep current): ") or row[1]
phone = input("New phone number
(leave blank to keep current): ") or row[2]
email = input("New email address
(leave blank to keep current): ") or row[3]
departure = input("New departure city
(leave blank to keep current): ") or row[4]
arrival = input("New arrival city (leave
blank to keep current): ") or row[5]
price = input("New price (leave blank to
keep current): ") or row[6]
if not found:
print("Flight number not found.")
return
def delete_record():
flight_no = input("Enter flight number to delete: ")
records = []
found = False
if os.path.exists(FILENAME):
with open(FILENAME, mode='r') as file:
reader = csv.reader(file)
for row in reader:
if row[0] == flight_no:
found = True
confirmation = input("Are you sure you
want to delete this record? (y/n): ").lower()
if confirmation == 'y':
print("Record deleted.")
continue # Skip appending this row
records.append(row)
if not found:
print("Flight number not found.")
return
def search_record():
flight_no = input("Enter flight number to search: ")
found = False
if os.path.exists(FILENAME):
with open(FILENAME, mode='r') as file:
reader = csv.reader(file)
print("\nSEARCH RESULTS:")
for row in reader:
if row[0] == flight_no:
found = True
print(" | ".join(row))
break
if not found:
print("Flight number not found.")
menu()
OUTPUT
ADDITION OF DETAILS
DISPLAY OF RECORDS
MODIFICATION OF RECORDS
DELETION OF RECORDS
SEARCHING OF A RECORD
REFERENCES
www.google.com
www.wikipedia.com