0% found this document useful (0 votes)
31 views18 pages

CS Project File

Project

Uploaded by

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

CS Project File

Project

Uploaded by

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

RAJKIYA PRATHIBA VIKAS VIDYALAYA

DELHI – 110092
SESSION 2024-2025

COMPUTER PROJECT ON FLIGHT


MANAGEMENT

NAME: Ritik Negi


CLASS : XII A
CBSE ROLL NO :
CERTIFICATE
This is to certify that Cadet ____________ CBSE Roll

No:_________________ has successfully completed the project Work entitled

Fitness Centre in the subject Computer Science (083) laid down in the regulations

of CBSE for the purpose of Practical Examination in Class XII to be held in

RPVV IP Extnension Patparganj Delhi -92

(Mr.Akant Sharma)
PGT Comp Science

Signature of External Examiner


Name: _______________________
Examiner Number:_______________
ACKNOWLEDGEMENT
Apart from the efforts of me, the success of any project depends largely on
the encouragement and guidelines of many others. I take this opportunity to express
my gratitude to the people who have been instrumental in the successful completion
of this project.
I express my heartfelt gratitude to my parents for constant encouragement
while carrying out this project.

I gratefully acknowledge the contribution of the individuals who contributed in


bringing this project up to this level, who continues to look after me despite my flaws,

I express my deep sense of gratitude to the luminary The Principal, RPVV IP


Extension Delhi-92 who has been continuously motivating and extending their
helping hand to us.

My sincere thanks to Mr. Akant Sharma, Master In-charge, A guide, A Mentor


, who critically reviewed my project and helped in solving each and every problem,
occurred during implementation of the project

The guidance and support received from all the members who
contributed and who are contributing to this project, was vital for the success
of the project. I am grateful for their constant support and help.
CONTENTS

1) Introduction

2) System Requirements

3) Source code

4) Output

5) Bibliography
INTRODUCTION
Flight Management System
A flight management system (FMS) is a fundamental component of a modern airliner's
avionics. An FMS is a specialized computer system that automates a wide variety of in-flight
tasks, reducing the workload on the flight crew to the point that modern civilian aircraft no
longer carry flight engineers or navigators. A primary function is in-flight management of the
flight plan. Using various sensors (such as GPS and INS often backed up by radio navigation)
to determine the aircraft's position, the FMS can guide the aircraft along the flight plan. From
the cockpit, the FMS is normally controlled through a Control Display Unit (CDU) which
incorporates a small screen and keyboard or touchscreen. The FMS sends the flight plan for
display to the Electronic Flight Instrument System (EFIS), Navigation Display (ND), or
Multifunction Display (MFD). The FMS can be summarised as being a dual system
consisting of the Flight Management Computer (FMC), CDU and a cross talk bus. The
modern FMS was introduced on the Boeing 767, though earlier navigation computers did
exist.[1] Now, systems similar to FMS exist on aircraft as small as the Cessna 182. In its
evolution an FMS has had many different sizes, capabilities and controls. However certain
characteristics are common to all FMSs.

Need of FMS
1. Minimized documentation and no duplication of records.
2. Reduced paper work.
3. Improved patient care
4. Better Administration Control
5. Faster information flow between various departments
6. Smart Revenue Management
7. Effective billing of various services
8. Exact stock information
SYSTEM REQUIREMENTS

1.Processor

2.Disk Space

3.Operating System

4.Python Version

5.Mysql Version
SOURCE CODE
import mysql.connector
from datetime import datetime

# Database connection
conn = mysql.connector.connect(
host="localhost",
user="rpvv",
password="rpvv"
)
cursor = conn.cursor()

# Create database and tables if they don't exist


cursor.execute("CREATE DATABASE IF NOT EXISTS airline_system")
cursor.execute("USE airline_system")

# Create Flights Table


cursor.execute("""
CREATE TABLE IF NOT EXISTS flights (
flight_id INT AUTO_INCREMENT PRIMARY KEY,
flight_name VARCHAR(255) NOT NULL,
departure VARCHAR(255) NOT NULL,
destination VARCHAR(255) NOT NULL,
departure_date DATE NOT NULL,
departure_time TIME NOT NULL,
arrival_date DATE NOT NULL,
arrival_time TIME NOT NULL,
economy_seats INT NOT NULL,
business_seats INT NOT NULL,
first_class_seats INT NOT NULL,
economy_price DECIMAL(10, 2) NOT NULL,
business_price DECIMAL(10, 2) NOT NULL,
first_class_price DECIMAL(10, 2) NOT NULL
)
""")

# Create Bookings Table


cursor.execute("""
CREATE TABLE IF NOT EXISTS bookings (
booking_id INT AUTO_INCREMENT PRIMARY KEY,
customer_name VARCHAR(255) NOT NULL,
flight_id INT NOT NULL,
class ENUM('economy', 'business', 'first_class') NOT NULL,
price DECIMAL(10, 2) NOT NULL,
departure VARCHAR(255) NOT NULL,
destination VARCHAR(255) NOT NULL,
departure_date DATE NOT NULL,
departure_time TIME NOT NULL,
arrival_date DATE NOT NULL,
arrival_time TIME NOT NULL,
FOREIGN KEY (flight_id) REFERENCES flights(flight_id)
)
""")

# Admin Functions
def add_flight():
flight_name = input("Enter flight name: ")
departure = input("Enter departure city: ")
destination = input("Enter destination city: ")
departure_date = input("Enter departure date (YYYY-MM-DD): ")
departure_time = input("Enter departure time (HH:MM:SS): ")
arrival_date = input("Enter arrival date (YYYY-MM-DD): ")
arrival_time = input("Enter arrival time (HH:MM:SS): ")
economy_seats = int(input("Enter number of economy seats: "))
business_seats = int(input("Enter number of business seats: "))
first_class_seats = int(input("Enter number of first-class seats: "))
economy_price = float(input("Enter price for economy class: "))
business_price = float(input("Enter price for business class: "))
first_class_price = float(input("Enter price for first class: "))

query = """INSERT INTO flights


(flight_name, departure, destination, departure_date, departure_time, arrival_date,
arrival_time,
economy_seats, business_seats, first_class_seats, economy_price, business_price,
first_class_price)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"""
values = (flight_name, departure, destination, departure_date, departure_time, arrival_date,
arrival_time,
economy_seats, business_seats, first_class_seats, economy_price, business_price,
first_class_price)

cursor.execute(query, values)
conn.commit()
print("Flight added successfully!")

def view_flights(admin=False):
print("\nView Flights Options:")
print("1. View all flights")
print("2. View flights by criteria (departure city, destination city, and date)")

choice = int(input("Enter your choice (1/2): ").strip())

if choice == 1:
cursor.execute("SELECT * FROM flights")
flights = cursor.fetchall()
elif choice == 2:
departure = input("Enter departure city: ")
destination = input("Enter destination city: ")
date = input("Enter departure date (YYYY-MM-DD): ")

query = """SELECT * FROM flights WHERE departure = %s AND destination = %s


AND departure_date = %s"""
cursor.execute(query, (departure, destination, date))
flights = cursor.fetchall()
else:
print("Invalid choice!")
return

if not flights:
print("No flights found matching the criteria.")
else:
for flight in flights:
print(f"Flight ID: {flight[0]}, Flight Name: {flight[1]}, Departure: {flight[2]},
Destination: {flight[3]}, "
f"Departure Date: {flight[4]}, Departure Time: {flight[5]}, Arrival Date:
{flight[6]}, Arrival Time: {flight[7]}, "
f"Economy Seats: {flight[8]}, Business Seats: {flight[9]}, First Class Seats:
{flight[10]}")

def view_bookings():
cursor.execute("SELECT * FROM bookings")
bookings = cursor.fetchall()
if not bookings:
print("No bookings found.")
for booking in bookings:
print(f"Booking ID: {booking[0]}, Customer Name: {booking[1]}, Flight ID:
{booking[2]}, Class: {booking[3]}, "
f"Price: {booking[4]}, Departure: {booking[5]}, Destination: {booking[6]},
Departure Date: {booking[7]}, "
f"Departure Time: {booking[8]}, Arrival Date: {booking[9]}, Arrival Time:
{booking[10]}")

# User Functions
def book_ticket():
view_flights(admin=False)
flight_id = int(input("Enter flight ID to book: "))
travel_class = input("Enter class (economy/business/first_class): ").strip().lower()

cursor.execute("SELECT * FROM flights WHERE flight_id = %s", (flight_id,))


flight = cursor.fetchone()

class_col = {
"economy": ("economy_seats", "economy_price"),
"business": ("business_seats", "business_price"),
"first_class": ("first_class_seats", "first_class_price")
}

if travel_class not in class_col:


print("Invalid class!")
return

seats_col, price_col = class_col[travel_class]


available_seats = flight[cursor.column_names.index(seats_col)]
price = flight[cursor.column_names.index(price_col)]

if available_seats <= 0:
print("No seats available in this class!")
return

print(f"Price per ticket: {price}")


num_tickets = int(input("How many tickets would you like to book? "))

if num_tickets > available_seats:


print(f"Sorry, there are not enough seats available. Only {available_seats} seats left.")
return

total_price = price * num_tickets


print(f"Total price for {num_tickets} tickets: {total_price}")

# Collect customer names for each ticket


customer_names = []
for i in range(num_tickets):
customer_name = input(f"Enter name for ticket {i + 1}: ")
customer_names.append(customer_name)

confirm = input("Confirm booking (yes/no)? ").strip().lower()


if confirm == "yes":
# Update the available seats
cursor.execute(f"UPDATE flights SET {seats_col} = {seats_col} - %s WHERE flight_id
= %s", (num_tickets, flight_id))

# Book each ticket and store the price


for name in customer_names:
booking_query = """INSERT INTO bookings
(customer_name, flight_id, class, price, departure, destination,
departure_date, departure_time, arrival_date, arrival_time)
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"""
booking_values = (name, flight_id, travel_class, price, flight[2], flight[3], flight[4],
flight[5], flight[6], flight[7])
cursor.execute(booking_query, booking_values)

# Update the prices based on the number of seats reduced


if travel_class == "economy":
cursor.execute("UPDATE flights SET economy_price = economy_price + 500
WHERE flight_id = %s", (flight_id,))
elif travel_class == "business":
cursor.execute("UPDATE flights SET business_price = business_price + 1000
WHERE flight_id = %s", (flight_id,))
elif travel_class == "first_class":
cursor.execute("UPDATE flights SET first_class_price = first_class_price + 10
WHERE flight_id = %s", (flight_id,))

conn.commit()
print(f"Booking confirmed! {num_tickets} tickets booked successfully!")

# Main Menu
def main():
while True:
print("\nChoose your role:")
print("1. Admin")
print("2. User")
print("3. Exit")
role_choice = int(input("Enter choice (1/2/3): ").strip())

if role_choice == 1:
while True:
print("\nAdmin Menu:")
print("1. Add Flight")
print("2. View Flights")
print("3. View Bookings")
print("4. Exit")
admin_choice = int(input("Enter choice (1/2/3/4): ").strip())

if admin_choice == 1:
add_flight()
elif admin_choice == 2:
view_flights(admin=True)
elif admin_choice == 3:
view_bookings()
elif admin_choice == 4:
break
else:
print("Invalid option. Please try again.")

elif role_choice == 2:
while True:
print("\nUser Menu:")
print("1. Book Ticket")
print("2. View Flights")
print("3. Exit")
user_choice = int(input("Enter choice (1/2/3): ").strip())

if user_choice == 1:
book_ticket()
elif user_choice == 2:
view_flights(admin=False)
elif user_choice == 3:
break
else:
print("Invalid option. Please try again.")

elif role_choice == 3:
print("Exiting the system. Goodbye!")
break
else:
print("Invalid input. Please try again.")

if __name__ == "__main__":
main()

conn.close()
OUTPUT
#Admin interface
1)Add Flights

2)View Flights
3)View Bookings
# User interface
1)Booking ticket
2)View Flight by criteria
# Mysql
1)Flights

2) Bookings
BIBLIOGRAPHY

Books :Preeti Arora and Sumita Arora

Websites :
https://kvcoders.in/class-12-new-content/python-project/

You might also like