Computer 123
Computer 123
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.
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.
3
PROPOSED SYSTEM
1. Objectives 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.
Booking Management:
4
Interactive User Interface:
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.
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.
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.
7
FLOWCHART
8
FUNCTION USED
1. create_database():
2. insert_sample_data():
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):
5. display_flights(flights):
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():
9. make_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)
Key Features:
Key Features:
11
Key Features:
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:
RAM: 4 GB / 8 GB or higher
Storage: 100 MB
Software Requirements:
SQLite: sqlite3
13
SOURCE CODE
import sqlite3
from prettytable import PrettyTable
conn.commit()
conn.close()
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()
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 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.")
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()
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()
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()
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
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.
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