0% found this document useful (0 votes)
64 views20 pages

CS Project Report

The document outlines the development of a Flight Ticket Booking System using Python and MySQL, aimed at streamlining booking and customer management processes. It details the system's architecture, including front-end and back-end technologies, user-defined functions, and a functional workflow for user registration, flight viewing, and booking. Future enhancements are also suggested to improve user experience and system capabilities.

Uploaded by

kanakchhajer99
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)
64 views20 pages

CS Project Report

The document outlines the development of a Flight Ticket Booking System using Python and MySQL, aimed at streamlining booking and customer management processes. It details the system's architecture, including front-end and back-end technologies, user-defined functions, and a functional workflow for user registration, flight viewing, and booking. Future enhancements are also suggested to improve user experience and system capabilities.

Uploaded by

kanakchhajer99
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/ 20

Computer Science Project Report

FLIGHT TICKET BOOKING SYSTEM

Harshil RS
INDEX

1. PROBLEM DEFINITION
2. PROBLEM ANALYSIS
3. HARDWARE AND SOFTWARE REQUIREMENT
4. FUTURE ENHANCEMENT
5. SOURCE CODE
6. OUTPUT
7. BIBLIOGRAPHY
PROBLEM DEFINITION

The problem is to develop a flight booking management


system using Python and MySQL connectivity to streamline
booking, cancellation, and customer management processes.
The system should ensure secure data handling, real-time
updates, and efficient database interactions to enhance user
experience and reduce operational complexities for airlines
and travel agencies.

NEED OF FLIGHT MANAGEMENT SYSTEM:


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
PROJECT ANALYSIS

The flight booking management system is a comprehensive software


solution designed to simplify and streamline the process of booking
flights, managing user accounts, and retrieving flight schedules. Built
using Tkinter for the user interface and Python MySQL Connector for
backend database operations, the system addresses the growing
need for a user-friendly and efficient platform tailored to individual
flight bookings.

Front-End Analysis: Tkinter

The system employs Tkinter to develop a graphical user interface


(GUI) that provides users with an intuitive and seamless interaction
experience. This interface supports core functionalities, including
creating user accounts, logging in, booking flights, and checking flight
schedules. Tkinter's robust collection of widgets, such as buttons,
entry fields, and labels, forms the backbone of these interactions.
Users are guided through well-organized menus and forms, ensuring
accessibility and ease of navigation regardless of their familiarity
with technology. By offering a straightforward and visually engaging
layout, Tkinter plays a crucial role in enhancing the usability and
appeal of the application.

Back-End Analysis: Python MySQL Connector

The backend of the system leverages the Python MySQL Connector


to establish and maintain connectivity with the underlying database.
This enables the system to handle essential operations such as user
registration, login verification, flight availability checks, and booking
confirmations. The database serves as a centralized and structured
repository, housing critical data including user details, flight
schedules, and booking records. Dynamic execution of SQL queries
ensures that users always receive the most accurate and up-to-date
information. This real-time interaction between the database and
the application guarantees a smooth and reliable user experience.

User-Defined Functions

To maintain clarity and modularity within the codebase, the system


incorporates several user-defined functions. These functions are
designed to handle distinct tasks, improving code reusability and
facilitating efficient system operations:

1. login_check(): Verifies user credentials against stored database


records to enable secure login.
2. create_user_account(): Facilitates the registration of new user
accounts by saving required details in the database.
3. register_user(): Ensures proper storage and unique
identification of user information during registration.
4. show_upcoming_flights(): Retrieves and displays a list of flights
scheduled for future dates, aiding users in travel planning.
5. book_flight(): Manages the flight booking process, including
checking seat availability and reservation options.
6. confirm_booking(): Finalizes flight reservations by logging the
confirmed booking details in the database.
7. show_available_flights(): Queries and presents flights with
available seats, offering users diverse travel options.

Each function is specifically tailored to address a distinct task,


ensuring the efficient handling of user requests and seamless
database transactions.

Functional Workflow

1. User Registration and Login:


New users can register by invoking the create_user_account()
function, which stores their details in the database. Existing
users can securely log in through the login_check() function.
Once authenticated, users gain access to all system features.
2. Viewing Flights:
Users can explore future travel options by utilizing the
show_upcoming_flights() function, which lists scheduled flights,
or the show_available_flights() function, which focuses on
flights with available seating. These queries dynamically fetch
and present data from the database, ensuring users receive
accurate and actionable information.
3. Booking Flights:
The book_flight() function allows users to select and reserve
their desired flights. Once a selection is made, the
confirm_booking() function ensures the reservation is logged
and updated in the database, solidifying the booking process.
4. Database Operations:
The system's backend handles all user and flight-related data
through centralized database management. Dynamic query
execution ensures that the GUI reflects real-time updates,
enabling consistent communication between the interface and
the database.

Conclusion

The flight booking management system effectively integrates Tkinter


and Python MySQL Connector to deliver a user-friendly and highly
functional platform for individual flight bookings. By modularizing
critical operations through user-defined functions, the system is both
easy to understand and maintain. This foundational implementation
not only meets the core requirements of flight bookings but also
provides ample flexibility for potential enhancements and scalability
in the future.
HARDWARE AND SOFTWARE REQUIRED HARDWARE

OS - Microsoft Windows 10

System type - X86-64 bit based processor

Processor - Intel(R) core(TM) i5-8250U

CPU - 2.4 GHz

Memory (RAM) - 8.00 GB

Front End - Python v3.8.2:7b3ab59, MSC v.1916 64 bit


(AMD64)]

Back End - MySQL Version 8.0


FUTURE ENHANCEMENTS

Here are some future enhancement ideas for the flight booking
management system:

1. Group Booking Feature: Allow users to book tickets for


multiple passengers in a single transaction.
2. Seat Selection: Enable users to choose preferred seats
during the booking process.
3. Dynamic Pricing Integration: Incorporate real-time
pricing updates based on demand and availability.
4. User Profiles: Create user accounts to save passenger
details, preferences, and booking history for a
personalized experience.
5. Payment Gateway Integration: Add secure payment
options, including credit/debit cards, UPI, and wallets.
6. Notifications and Alerts: Notify users about booking
confirmations, cancellations, and schedule changes via
email or SMS.
7. Flight Filters: Allow users to filter flights based on criteria
like price, layovers, and airlines.
8. Cancellation and Refund Management: Automate ticket
cancellations and refund processing.
SOURCE CODE

import mysql.connector
import tkinter as tk
from tkinter import messagebox
mydb = mysql.connector.connect(
host="localhost",
user="root",
password="Flat@115",
database="joe"
)
mydb = mysql.connector.connect(
host="localhost",
user="root",
password="Flat@115",
database="joe"
)
mycursor = mydb.cursor()
# Function to check user login credentials
def login_check():
username = username_entry.get()
password = password_entry.get()
mycursor.execute("SELECT * FROM users WHERE username = %s AND password = %s",
(username, password))
result = mycursor.fetchone()
if result:
messagebox.showinfo("Login Successful", "Welcome, " + username)
login_window.destroy()
main_window()
else:
messagebox.showerror("Login Failed", "Invalid username or password")
# Function to create a user account
def create_user_account():
# Create a new window for user registration
registration_window = tk.Toplevel()
registration_window.title("User Registration")
# Create labels and entry fields for user details
username_label = tk.Label(registration_window, text="Username:")
username_label.pack()
username_entry = tk.Entry(registration_window)
username_entry.pack()
password_label = tk.Label(registration_window, text="Password:")
password_label.pack()
password_entry = tk.Entry(registration_window, show="*")
password_entry.pack()
# Create a button to register the user
register_button = tk.Button(registration_window, text="Register",
command=register_user)
register_button.pack()
def register_user():
username = username_entry.get()
password = password_entry.get()
# Check if username already exists
mycursor.execute("SELECT * FROM users WHERE username = %s", (username,))
result = mycursor.fetchone()

if result:
messagebox.showerror("Registration Failed", "Username already exists. Please choose
a different username.")
else:
# Insert user details into the database
mycursor.execute("INSERT INTO users (username, password) VALUES (%s, %s)",
(username, password))
mydb.commit()
messagebox.showinfo("Registration Successful", "You have been registered
successfully.")
registration_window.destroy()
# Function to display user's upcoming flights
def show_upcoming_flights():
global r
username = r
mycursor.execute("SELECT
booking_id,flights.flight_id,flights.departure,flights.arrival,flights.date FROM
flights,bookings WHERE bookings.username = %s and flights.flight_id = bookings.flight_id",
(username,))
result = mycursor.fetchall()
# Create a new window to display upcoming flights
upcoming_flights_window = tk.Toplevel()
upcoming_flights_window.title("Upcoming Flights")
# Create a listbox to display flights
flight_list = tk.Listbox(upcoming_flights_window)
flight_list.pack(padx=10,pady=10,fill=tk.BOTH,expand=True)
if result:
for row in result:
flight_list.insert(tk.END, f"Flight ID: {row[1]}, Departure: {row[2]}, Arrival: {row[3]},
Date: {row[4]}")
print(row)
else:
flight_list.insert(tk.END, "No upcoming flights found.")
flight_list.pack()

# Create a button to close the window


close_button = tk.Button(upcoming_flights_window, text="Close",
command=upcoming_flights_window.destroy)
close_button.pack()
# Function to book a flight
def book_flight():
# Create a new window for flight booking
global booking_window
global n
global e
global p
booking_window = tk.Toplevel()
booking_window.title("Book Flight")
# Fetch available flights
mycursor.execute("SELECT * FROM flights WHERE availability > 0")
available_flights = mycursor.fetchall()
# Create a listbox to display flights
flight_listbox = tk.Listbox(booking_window)
for flight in available_flights:
flight_listbox.insert(tk.END, f"Flight ID: {flight[0]}, Departure: {flight[1]}, Arrival:
{flight[2]}, Date: {flight[3]}, Price: {flight[4]}")
flight_listbox.pack(padx=10,pady=10,fill=tk.BOTH,expand=True)
# Create labels and entry fields for user details
name_label = tk.Label(booking_window, text="Name:")
name_label.pack()
name_entry = tk.Entry(booking_window)
name_entry.pack()
email_label = tk.Label(booking_window, text="Email:")
email_label.pack()
email_entry = tk.Entry(booking_window)
email_entry.pack()
phone_label = tk.Label(booking_window, text="Phone:")
phone_label.pack()
phone_entry = tk.Entry(booking_window)
phone_entry.pack()
n = name_entry.get()
e = email_entry.get()
p = phone_entry.get()
print(n)
# Create a button to confirm the booking
book_button = tk.Button(booking_window, text="Book Flight", command=lambda:
confirm_booking(flight_listbox.curselection(), n, e, p, available_flights))
book_button.pack()
def confirm_booking(selected_index, name, email, phone, available_flights):
global r
global n
global e
global p
global booking_window
if selected_index:
selected_flight_id = available_flights[selected_index[0]][0]
# Check availability
mycursor.execute("SELECT availability FROM flights WHERE flight_id = %s",
(selected_flight_id,))
availability = mycursor.fetchone()[0]
if availability > 0:
# Check if username already exists
mycursor.execute("SELECT * FROM users WHERE username = %s", (r,)) # Use
username_entry.get()
result = mycursor.fetchone()
# Book the flight
mycursor.execute("INSERT INTO bookings (flight_id, username, name, email, phone)
VALUES (%s, %s, %s, %s, %s)",
(selected_flight_id, r, n, e, p))
mydb.commit()
# Update flight availability
mycursor.execute("UPDATE flights SET availability = availability - 1 WHERE flight_id =
%s", (selected_flight_id,))
mydb.commit()
booking_window.destroy() # Close the booking window
messagebox.showinfo("Booking Successful", "Your flight has been booked
successfully!")
else:
messagebox.showerror("Booking Failed", "The chosen flight is not available.")
else:
messagebox.showerror("Booking Failed", "Please select a flight to book.")
def show_available_flights():
# Fetch available flights
mycursor.execute("SELECT * FROM flights WHERE availability > 0")
available_flights = mycursor.fetchall()
# Create a new window to display available flights
available_flights_window = tk.Toplevel()
available_flights_window.title("Available Flights")
# Create a listbox to display flights
flight_list = tk.Listbox(available_flights_window)
for flight in available_flights:
flight_list.insert(tk.END, f"Flight ID: {flight[0]}, Departure: {flight[1]}, Arrival: {flight[2]},
Date: {flight[3]}, Price: {flight[4]}")
flight_list.pack(padx=10,pady=10,fill=tk.BOTH,expand=True)

# Create a button to close the window


close_button = tk.Button(available_flights_window, text="Close",
command=available_flights_window.destroy)
close_button.pack()
# Create login window
login_window = tk.Tk()
login_window.title("Flight Booking System")
username_label = tk.Label(login_window, text="Username:")
username_label.pack()
username_entry = tk.Entry(login_window)
username_entry.pack()
r = username_entry.get()
password_label = tk.Label(login_window, text="Password:")
password_label.pack()
password_entry = tk.Entry(login_window, show="*")
password_entry.pack()
login_button = tk.Button(login_window, text="Login", command=login_check)
login_button.pack()
register_button = tk.Button(login_window, text="Register",
command=create_user_account)
register_button.pack()
# Create main window
def main_window():
main_window = tk.Tk()
main_window.title("Flight Booking System")
# Add buttons for different functionalities
upcoming_flights_button = tk.Button(main_window, text="Upcoming Flights",
command=show_upcoming_flights)
upcoming_flights_button.pack()

book_flight_button = tk.Button(main_window, text="Book Flight", command=book_flight)


book_flight_button.pack()
available_flights_button = tk.Button(main_window, text="Available Flights",
command=show_available_flights)
available_flights_button.pack()
main_window.mainloop()
login_window.mainloop()
SAMPLE OUTPUT
BIBLIOGRAPHY

● The Complete Reference Python byMartin C. Brown from


Mc. GrawHill publications
● Computer Science with Python by Sumita Arora from
Dhanpat Rai & Co. publications
● www.geeksforgeeks.org
● www.python.org

You might also like