0% found this document useful (0 votes)
33 views34 pages

Computer 123

Uploaded by

ly.alnahari7
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)
33 views34 pages

Computer 123

Uploaded by

ly.alnahari7
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/ 34

INTRODUCTION

A Flight Booking System is a software application or tool designed to


facilitate the reservation and management of air travel. It streamlines
the process of booking tickets, updating passenger details, managing
schedules, and ensuring a seamless travel experience for users. With
advancements in technology, flight booking systems have become a
core component of the travel industry, catering to the needs of
passengers, travel agencies, and airlines.

The system allows users to perform various operations such as


searching for flights, booking tickets, modifying existing bookings, and
even canceling reservations. It ensures efficiency, reduces manual
errors, and enhances user satisfaction by offering a user-friendly
interface and real-time updates on flight availability.

Incorporating essential features like data storage, email reminders, and


passenger management, the flight booking system provides an
organized way to handle a large volume of bookings. This makes it an
indispensable tool in the modern aviation and travel ecosystem.

1
OBJECTIVES
1. Provide Convenience:
Allow users to easily search and book hotels and flights from a
single platform, saving time and effort.

2.Real-time Availability:
Display up-to-date information on hotel rooms, flight seats, and
availability, ensuring accurate bookings.

3.Enhance User Experience:


Offer a user-friendly interface with intuitive navigation for a
smooth booking process.

4.Secure Payment Processing:


Ensure safe and seamless payment transactions for booking
hotels, flights, and additional services.

5.Customization and Personalization:


Provide tailored recommendations based on user preferences,
such as travel dates, budget, and destination.

6.Cost Comparison:
Enable users to compare prices for flights and hotels across
different providers to find the best deals.

7.Automate Operations:
Streamline booking management, reservations, and cancellations
for both customers and service providers

8.Increase Revenue:
Maximize bookings and sales for hotels, airlines, and other
services by offering an easy-to-access online platform.

2
9.Multilingual and Multi-currency Support:
Offer support for various languages and currencies to cater to a
global audience.

10.Integration with Other Services:


Provide access to additional travel services like car rentals, travel
insurance, and tours for a comprehensive travel experience.

3
PROPOSED SYSTEM
1. Objectives of the Proposed System

 Automation of Flight Bookings: Replace manual booking processes with an


automated system that reduces errors and saves time.
 Centralized Data Management: Store and manage flight and booking data
in a structured SQLite database to ensure consistency and easy retrieval.
 Enhanced Customer Interaction: Allow users to search for flights, book
tickets, manage bookings, and view their reservations seamlessly.
 Cost Efficiency: Utilize lightweight technologies like SQLite and Python to
keep development and operational costs low.

2. Features of the Proposed System

Flight Management:

o Add, update, and delete flight records, including details such as flight
name, departure location, destination, departure and arrival times,
travel dates, and ticket prices.

Customer Booking Functionality:

o Enable customers to:


 Search for flights based on specific criteria (e.g., departure
location, destination, and travel date).
 Select a flight and book tickets for multiple passengers.
 View booking confirmation with detailed flight and pricing
information.

Booking Management:

o Allow customers to:


 View existing bookings by entering their name or contact
details.
 Update their bookings, including changing flights or the
number of passengers.
 Cancel bookings if needed.

4
Interactive User Interface:

o Provide a menu-driven interface that is intuitive and easy to navigate


for users with minimal technical expertise.
o Display data in a tabular format using PrettyTable for better
readability.

Database Integration:

o Use SQLite for data storage and retrieval, ensuring all flight and
booking details are stored securely and efficiently.
o Perform CRUD (Create, Read, Update, Delete) operations to manage
data dynamically.

Error Handling and Validation:

o Validate user inputs to ensure data integrity (e.g., valid dates, correct
flight IDs, contact information).
o Handle errors gracefully, such as invalid flight searches or incorrect
booking IDs.

3. Advantages of the Proposed System

 Time-Saving: Automates repetitive tasks like flight search and booking,


reducing the time required for these operations.
 Accuracy: Ensures data consistency through structured database
management and validation mechanisms.
 Scalability: Can easily be extended to include more features, such as
integration with payment systems or real-time flight updates.
 Accessibility: Provides an interactive and user-friendly interface, making it
accessible to a wide range of users.

4. Scope for Future Enhancements

 Online Integration: Expand the system to work with web-based


applications or APIs for real-time flight schedules.
 Payment Gateway: Integrate secure payment options to allow customers
to pay for tickets online.
 Notifications: Add email or SMS notifications for booking confirmations,
updates, or cancellations.

5
 Advanced Search Options: Include filters like layovers, airlines, or ticket
class for more customized flight searches.

The proposed flight booking system offers a robust solution for managing flight
schedules and reservations. It is designed to meet the needs of customers and
administrators by providing an efficient, automated, and user-friendly platform.
By utilizing SQLite and Python, the system ensures cost efficiency, data accuracy,
and scalability, making it suitable for small to medium-sized businesses. With
future enhancements, the system can be transformed into a comprehensive
booking platform catering to more complex needs.

6
SYSTEM DEVELOPMENT LIFE CYCLE
For the Flight Booking System code began with the requirement
analysis phase, where the functional and non-functional requirements
of the system were identified. Core features such as flight search,
booking, cancellation, payment processing, and user management were
defined, along with the necessary system specifications like database
integration, user interface design, and performance goals. Following
this, the system design phase outlined the architecture of the system,
including the development of flowcharts, user interface prototypes,
and a database schema to store flight, user, and booking details.

In the implementation phase, the code was developed using modular


programming, ensuring functions like searchFlights(), bookFlight(), and
generateTicket() were reusable and easy to maintain. APIs were
integrated for payment processing and email notifications. Rigorous
testing was conducted, including unit testing for individual functions,
integration testing for smooth interaction between modules, system
testing to validate functional requirements, and user acceptance testing
(UAT) to ensure user-friendliness.

Once the system was thoroughly tested, it was deployed on a suitable


platform, such as a web server or cloud service, making it accessible for
real-time operations. The maintenance phase involved addressing user
feedback, fixing any post-deployment issues, and providing updates to
enhance features, add new functionalities like real-time flight tracking,
and ensure compatibility with evolving technologies. By following SDLC
practices, the code delivered a robust, efficient, and user-friendly flight
booking system that met stakeholder expectations.

7
FLOWCHART

8
FUNCTION USED
1. create_database():

 Creates a SQLite database (booking_system.db) and two tables:


Flights and Bookings.
 Drops and recreates the tables if they already exist.

2. insert_sample_data():

 Inserts sample flight data into the Flights table.


 The sample data contains flight details such as flight name, departure and
arrival locations, times, travel date, and price.

3. browse_flights(from_location, to_location,
travel_date):

 Queries the Flights table to find flights based on the provided departure
location (from_location), destination (to_location), and travel date
(travel_date).
 Returns a list of flights that match the criteria.

4. book_flight(customer_name, customer_contact,
flight_id, num_of_people):

 Books a flight for a customer by inserting a record into the Bookings


table.
 Fetches flight details from the Flights table based on the flight_id.
 Displays booking confirmation with flight details and the total price.

5. display_flights(flights):

 Displays the list of flights in a readable format.


 If no flights match the criteria, it prints a message indicating no flights were
found.

6. view_booking():

 Prompts the customer to enter their name and displays their booking details
from the Bookings and Flights tables.

9
 Uses the PrettyTable module to display the booking information in a
formatted table.

7. delete_booking():

 Prompts the customer to enter their name to find and delete their booking
record in the Bookings table.
 Deletes the booking if it exists and confirms the deletion.

8. update_booking():

 Allows customers to update their booking.


 They can choose to update the flight or the number of passengers.
 If updating the flight, it prompts the user to enter new flight criteria and
updates the booking with the new flight ID if available.
 If updating the number of passengers, it allows the user to modify the number
of people in the booking.

9. make_booking():

 This is the main function to initiate a booking process.


 It prompts the user to enter their name, contact, flight criteria (departure,
destination, and date).
 After fetching the available flights, it lets the user select a flight and proceed
with the booking.

10. main():

 Displays the main menu of the booking system with options for making a
booking, viewing, deleting, or updating a booking.
 Calls the relevant function based on the user's choice in a loop until the user
chooses to exit.

10
MODULES USED
1. sqlite3 (SQLite Module)

 Purpose: This module is used to interact with SQLite databases in Python.


SQLite is a lightweight, disk-based database that doesn’t require a separate
server process, making it perfect for small to medium-scale applications.

Key Features:

 Database Creation and Connection: Allows you to create and manage a


SQLite database (in this case, booking_system.db) directly from
Python.
 Executing SQL Queries: Supports SQL queries to interact with the
database, including creating tables, inserting data, updating, deleting, and
retrieving records.
 Cursor Management: The module uses cursors to execute SQL queries and
retrieve results in a structured format.
 Transactions: It handles commit and rollback operations to ensure database
changes are saved correctly or undone if needed.

2. prettytable (PrettyTable Module)

 Purpose: This module is used to generate formatted, readable tables for


displaying data in the console. It’s particularly useful for displaying query
results in a structured table format.

Key Features:

 Formatted Output: Allows the display of data in a neatly organized,


aligned table format, making it easy to interpret.
 Customization: Supports customization of table headers, alignment, column
width, and other formatting options.
 Row Management: Supports adding rows to a table dynamically, which is
useful for displaying query results from a database or user inputs.

3. sys (System Module)

 Purpose: The sys module provides access to system-specific parameters


and functions. It is commonly used for managing program termination and
handling system-level operations.

11
Key Features:

 Program Exit: The sys.exit() function is used to exit the program


immediately, which is useful for gracefully terminating the program based
on user input or error conditions.
 Command-line Arguments: Allows for handling command-line arguments,
though not utilized directly in your code, it could be used to pass parameters
when running the script.
 System-Specific Information: Provides access to system-related variables
such as the platform, Python version, and the maximum recursion limit.

Together, these modules provide the core functionality needed to implement the
flight booking system, offering both database management and a clean user
interface.

12
HARDWARE AND SOFTWARE REQUIREMENTS

Hardware Requirements:

Processor: Intel i3/i5 or equivalent

RAM: 4 GB / 8 GB or higher

Storage: 100 MB

Software Requirements:

Operating System: Windows 10 or later

Python Version: Python 3.6 or higher

Required Python Libraries: sqlite3 , prettytable

SQLite: sqlite3

13
SOURCE CODE
import sqlite3
from prettytable import PrettyTable

# Create Database and Tables


def create_database():
conn = sqlite3.connect('booking_system.db')
c = conn.cursor()

# Drop and recreate the Flights table


c.execute('DROP TABLE IF EXISTS Flights')
c.execute('''CREATE TABLE Flights (
id INTEGER PRIMARY KEY AUTOINCREMENT,
flight_name TEXT,
from_location TEXT,
to_location TEXT,
departure_time TEXT,
arrival_time TEXT,
travel_date TEXT,
14
price REAL)''')

# Drop and recreate the Bookings table


c.execute('DROP TABLE IF EXISTS Bookings')
c.execute('''CREATE TABLE Bookings (
id INTEGER PRIMARY KEY AUTOINCREMENT,
booking_type TEXT,
booking_id INTEGER,
customer_name TEXT,
customer_contact TEXT,
num_of_people INTEGER)''')

conn.commit()
conn.close()

# Insert Sample Flight Data


def insert_sample_data():
conn = sqlite3.connect('booking_system.db')
c = conn.cursor()

15
flights = [
('Saudia', 'Jeddah', 'Mumbai', '10:00 AM', '1:00 PM', '2024-
12-01', 200.00),
('AirIndia', 'Mumbai', 'Jeddah', '3:00 PM', '6:00 PM', '2024-
12-01', 220.00),
('Flynas', 'Vietnam', 'Jeddah', '8:00 AM', '12:00 PM', '2024-
12-02', 150.00),
('Flynas', 'Jeddah', 'Vietnam', '5:00 PM', '9:00 PM', '2024-
12-03', 180.00)
]
c.executemany('INSERT INTO Flights (flight_name,
from_location, to_location, departure_time, arrival_time,
travel_date, price) VALUES (?, ?, ?, ?, ?, ?, ?)', flights)

conn.commit()
conn.close()

# Browse Flights by Filters


def browse_flights(from_location, to_location, travel_date):
conn = sqlite3.connect('booking_system.db')
16
c = conn.cursor()
c.execute('SELECT * FROM Flights WHERE from_location = ?
AND to_location = ? AND travel_date = ?',
(from_location, to_location, travel_date))
flights = c.fetchall()
conn.close()
return flights

# Book a Flight and Display Details


def book_flight(customer_name, customer_contact, flight_id,
num_of_people):
conn = sqlite3.connect('booking_system.db')
c = conn.cursor()
c.execute('SELECT * FROM Flights WHERE id = ?', (flight_id,))
flight = c.fetchone()

if flight:
c.execute('INSERT INTO Bookings (booking_type,
booking_id, customer_name, customer_contact,
num_of_people) VALUES (?, ?, ?, ?, ?)',

17
('Flight', flight_id, customer_name,
customer_contact, num_of_people))
conn.commit()

# Display Booking Details


print("\nBooking Confirmed!")
print(f"Passenger Name: {customer_name}")
print(f"Contact: {customer_contact}")
print(f"Flight Name: {flight[1]}")
print(f"From: {flight[2]} To: {flight[3]}")
print(f"Departure Time: {flight[4]} Arrival Time: {flight[5]}")
print(f"Travel Date: {flight[6]}")
print(f"Price: ${flight[7]:.2f} x {num_of_people} passengers
= ${flight[7] * num_of_people:.2f}")
else:
print("\nInvalid flight ID. Please try again.")
conn.close()

# Display Flights

18
def display_flights(flights):
if flights:
print("\nAvailable Flights:")
for flight in flights:
print(f"ID: {flight[0]}, Flight Name: {flight[1]}, From:
{flight[2]}, To: {flight[3]}, Departure: {flight[4]}, Arrival:
{flight[5]}, Date: {flight[6]}, Price: ${flight[7]:.2f}")
else:
print("\nNo flights available for the given criteria.")

# View Booking Details


def view_booking():
conn = sqlite3.connect('booking_system.db')
c = conn.cursor()

customer_name = input("Enter your name to view booking


details: ").strip()
c.execute('''SELECT b.customer_name, b.customer_contact,
f.flight_name, f.from_location,

19
f.to_location, f.departure_time, f.arrival_time,
f.travel_date, f.price, b.num_of_people
FROM Bookings b
JOIN Flights f ON b.booking_id = f.id
WHERE b.customer_name = ?''', (customer_name,))
bookings = c.fetchall()
conn.close()

if bookings:
print("\nYour Booking Details:")
table = PrettyTable()
table.field_names = ["Name", "Contact", "Flight", "From",
"To", "Departure", "Arrival", "Date", "Price", "People"]
for booking in bookings:
table.add_row(booking)
print(table)
else:
print("\nNo bookings found for your name.")

20
# Delete a Booking
def delete_booking():
conn = sqlite3.connect('booking_system.db')
c = conn.cursor()

customer_name = input("Enter your name to delete the


booking: ").strip()
c.execute('SELECT * FROM Bookings WHERE customer_name
= ?', (customer_name,))
booking = c.fetchone()

if booking:
c.execute('DELETE FROM Bookings WHERE customer_name
= ?', (customer_name,))
conn.commit()
print("\nBooking deleted successfully!")
else:
print("\nNo booking found with the given name.")
conn.close()

21
# Update a Booking
def update_booking():
conn = sqlite3.connect('booking_system.db')
c = conn.cursor()

customer_name = input("Enter your name to update the


booking: ").strip()
c.execute('SELECT * FROM Bookings WHERE customer_name
= ?', (customer_name,))
booking = c.fetchone()

if booking:
print("\nWhat would you like to update?")
print("1. Change flight")
print("2. Update the number of passengers")
choice = int(input("Enter your choice: "))

if choice == 1:
# Update flight

22
from_location = input("Enter your new departure
location: ").strip()
to_location = input("Enter your new destination location:
").strip()
travel_date = input("Enter your new travel date (YYYY-
MM-DD): ").strip()

# Fetch available flights


flights = browse_flights(from_location, to_location,
travel_date)
display_flights(flights)

if flights:
new_flight_id = int(input("\nEnter the new flight ID: "))
c.execute('UPDATE Bookings SET booking_id = ?
WHERE customer_name = ?', (new_flight_id, customer_name))
conn.commit()
print("\nFlight updated successfully!")
else:
print("\nNo available flights for the new criteria.")

23
elif choice == 2:
# Update number of passengers
new_num_of_people = int(input("Enter the new number
of passengers: "))
c.execute('UPDATE Bookings SET num_of_people = ?
WHERE customer_name = ?', (new_num_of_people,
customer_name))
conn.commit()
print("\nNumber of passengers updated successfully!")
else:
print("\nInvalid choice.")
else:
print("\nNo booking found with the given name.")
conn.close()

# Make a Booking
def make_booking():
print("\nBooking System")
customer_name = input("Enter your name: ")
customer_contact = input("Enter your contact number: ")
24
# Flight Filters
from_location = input("Enter your departure location:
").strip()
to_location = input("Enter your destination location: ").strip()
travel_date = input("Enter your travel date (YYYY-MM-DD):
").strip()

# Fetch Flights
flights = browse_flights(from_location, to_location,
travel_date)
display_flights(flights)

if flights:
flight_id = int(input("\nEnter the flight ID you want to
book: "))
num_of_people = int(input("Enter the number of people:
"))
book_flight(customer_name, customer_contact, flight_id,
num_of_people)

25
# Main Menu
def main():
create_database()
insert_sample_data()

while True:
print("\nWelcome to the Booking System!")
print("1. Make a Booking")
print("2. View My Booking")
print("3. Delete My Booking")
print("4. Update My Booking")
print("5. Exit")
choice = int(input("Enter your choice: "))

if choice == 1:
make_booking()
elif choice == 2:
view_booking()
elif choice == 3:

26
delete_booking()
elif choice == 4:
update_booking()
elif choice == 5:
print("Thank you for using the Booking System!")
break
else:
print("Invalid choice. Please try again.")

if _name_ == "_main_":
main()

27
OUTPUTS
1. Menu

2. Make a Booking

28
3. View My Booking

4.Delete My Booking

29
5. Update My Booking
i) Change flight

ii) Update the number of passengers

30
6. Exit

31
BENEFITS
 Centralized Data:
The use of an SQLite database allows for centralized storage of flight and booking
information, ensuring that all data is stored in a structured format and can be easily
accessed or modified.

 Automated Search and Booking:


Users can quickly search for flights based on departure and destination locations,
as well as travel dates, streamlining the process of flight selection and booking.

 Real-time Updates:

The system allows for easy updates, enabling the business to add, modify, or delete
flight information as needed without disruption.

 Booking Confirmation:

The system confirms bookings with clear details on the flight, customer, and price,
ensuring transparency and reducing errors during the booking process.

 Manage Bookings:

Customers can view their booking details, update reservations, or cancel them,
giving users full control over their travel plans without needing direct interaction
with customer service.

 Faster Service:
Automation of the booking process reduces wait times for customers, providing a
quicker and more reliable way to book flights.

 Error Reduction:

By allowing customers to directly manage their bookings, the system reduces the
chances of human errors that might occur during manual processing.

32
CONCLUSION
A flight and hotel booking system simplifies the travel planning
process by integrating multiple functionalities into a single
platform. It streamlines tasks such as user registration,
searching for flights and hotels, booking options, and secure
payment processing. These systems enhance user experience
through features like filtering options, real-time availability
updates, and personalized recommendations.
By automating complex processes, they reduce human errors,
save time, and offer convenience to users while ensuring
efficiency for service providers. A well-designed booking system
is crucial for maintaining customer satisfaction and fostering
loyalty in the highly competitive travel industry.

33
BIBLIOGRAPHY

https://www.mysql.com

https://gemini.google.com

https://www.python.org

34

You might also like