FLIGHT BOOKING Project
FLIGHT BOOKING Project
ROLL NO:
INDEX
01 Introduction
02 Objective
03 System Requirements
04 Source Code
05 Output
06 Conclusion
07 Reference
INTRODUCTION
1. Hardware Requirements
2. Software Requirements
• Programming Language: Python 3.6 or higher
• Libraries and Dependencies:
o Pandas: For data manipulation and analysis
oNumPy: For numerical operations (optional
but useful for advanced calculations
SOURCE CODE
# Creating tables
cursor.execute('''CREATE TABLE IF NOT
EXISTS flights (
flight_id INTEGER PRIMARY
KEY,
airline_name TEXT,
departure TEXT,
arrival TEXT,
departure_time TEXT,
arrival_time TEXT,
price REAL)''')
conn.commit()
conn.close()
print("\nAvailable Flights:")
print("Flight ID | Airline | From | To |
Departure | Arrival | Price")
for flight in flights:
print(f"{flight[0]} | {flight[1]} | {flight[2]} |
{flight[3]} | {flight[4]} | {flight[5]} |
{flight[6]}")
conn.close()
conn = sqlite3.connect('airline_booking.db')
cursor = conn.cursor()
try:
cursor.execute("INSERT INTO bookings
(passenger_name, flight_id, booking_date)
VALUES (?, ?, ?)",
(passenger_name, flight_id,
booking_date))
conn.commit()
print("\nBooking successful!")
except sqlite3.Error as e:
print("\nError: Unable to book the ticket.",
e)
conn.close()
print("\nYour Bookings:")
print("Booking ID | Name | Flight ID | Date")
for booking in bookings:
print(f"{booking[0]} | {booking[1]} |
{booking[2]} | {booking[3]}")
conn.close()
# Main menu
def main_menu():
initialize_database()
while True:
print("\n--- Air Ticket Booking System ---")
print("1. View Flights")
print("2. Book a Ticket")
print("3. View Bookings")
print("4. Exit")
Booking successful!
Viewing Bookings
yaml
Copy code
Your Bookings:
Booking ID | Name | Flight ID | Date
1 | John Doe | 2 | 2024-12-18 14:30:00
Exit
sql
Copy code
--- Air Ticket Booking System ---
1. View Flights
2. Book a Ticket
3. View Bookings
4. Exit
Enter your choice: 4