Bus Booking Mgmt System
Bus Booking Mgmt System
Academic Session:2024-25
Project Report
on
“Bus Booking Management System”
(For AISSCE 2024-25 Examination)
Signature of Signature of
Internal Examiner External Examiner
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 deep sense of gratitude to almighty God for giving me strength for
the successful completion of the project. I am greatly indebted to Ms Madhu Sehgal,
Teacher in Computer Science who gave me immense support and guidance
throughout the completion of this project.
6. Coding 15
7. Output Screens 24
8. User Manual 28
9. Bibliography 30
5
INTRODUCTION
The Bus Booking Management System is a software solution crafted to
automate the processes involved in managing bus ticketing services. This
comprehensive program is designed to cater to the needs of both
passengers and system administrators, offering a seamless and efficient
platform for booking bus tickets.
6
OBJECTIVES AND SCOPE OF
THE PROJECT
7
The Bus Booking Management System encompasses several key features:
1. User Management: Allows users to create accounts, log in, and manage their
bookings.
2. Route Display: Displays available bus routes with details like source,
destination, departure time, and charges.
3. Booking System: Enables users to book tickets for desired routes and
provides receipts upon successful booking.
4. Cancellation: Provides an option for users to cancel their bookings.
5. Review System: Allows users to leave reviews and ratings for routes they've
traveled on.
6. Staff Access: Offers staff members the ability to manage bookings and review
user feedback.
The project lays the groundwork for promising enhancements and expansions that
could elevate its functionality and user experience to new heights.
In the future, the system's user interface could be upgraded for a more visually
appealing and user-friendly experience. Implementing graphics, better navigation,
and intuitive design elements could make it even easier for users to book tickets and
explore routes
Implementing real-time updates and notifications for users about their bookings,
route changes, or new offers could enhance user engagement and keep them
informed about their travel plans.
8
Hardware and Software
Specifications
HARDWARE REQUIREMENTS
V. Printer : LaserJet
SOFTWARE REQUIREMENTS:
9
Modules and Functions Used
Python is a powerful programming language known for its flexibility and ease.
It's great for building applications quickly and connecting different parts of
software. Python's built-in tools and flexible approach make it perfect for Rapid
Application Development. Python's straightforward writing style makes
programs easy to understand and maintain. It lets you organize code neatly and
reuse it in different projects.Python supports modules and packages, which
encourages program modularityand code reuse. The Python interpreter and the
extensive standard library are available in source or binary form without charge
for all major platforms, and can be freely distributed.
10
Following modules are used in this project:
1. create_tables():
Creates essential tables in the database to manage bus routes, user information,
bookings, reviews, and more.
2. insertdata():
Inserts initial data into the "bus_routes" table to populate it with various bus
routes, including their IDs, bus numbers, sources, destinations, departure
times, and charges.
3. display_routes():
Fetches and displays all available bus routes from the "bus_routes" table,
showcasing route IDs, bus numbers, sources, destinations, departure times,
and charges.
Enables users to book a bus ticket by providing the route ID and desired
payment method. It creates a booking record in the "bookings" table with
associated user and route IDs.
11
5.show_receipts(user_id):
Retrieves and displays booking receipts for a specific user from the "bookings"
table, showcasing booking IDs, bus numbers, departure times, sources,
destinations, and charges.
6.cancel_booking(booking_id):
Allows users to cancel a booking by providing the booking ID, removing the
corresponding entry from the "bookings" table.
Permits users to add reviews for a specific bus route by providing their user
ID, the route ID, a rating, and feedback. It adds the review to the "review"
table associated with the user and route.
Facilitates the creation of new users by inserting their details into the "users"
table, including user IDs, usernames, passwords, and staff status.
12
Database and Tables Used
Database used in this project :
• bus
Tables used in this project :
• bus routes
• users
13
• bookings
• reviews
14
SOURCE CODE
import mysql.connector
myconn = mysql.connector.connect(host="localhost", user="root", passwd="", database="bus")
mycursor = myconn.cursor()
def create_tables()
#table bus_routes
try:
mycursor.execute("CREATE TABLE IF NOT EXISTS bus_routes (route_id INT
PRIMARY KEY, bus_number VARCHAR(20), source VARCHAR(50), destination
VARCHAR(50), departure_time TIME, charges DECIMAL(10,2))")
except Exception as e:
print("Error creating bus_routes table: " + str(e))
#table users
try:
mycursor.execute("CREATE TABLE IF NOT EXISTS users (user_id INT PRIMARY
KEY, username VARCHAR(50), password VARCHAR(50), is_staff CHAR(1))")
print("table created successfully!")
except Exception as e:
print("Error creating users table: " + str(e))
#table bookings
15
try:
mycursor.execute("CREATE TABLE IF NOT EXISTS bookings (booking_id INT
PRIMARY KEY, user_id INT, route_id INT, payment_method VARCHAR(50),
payment_status CHAR(1), FOREIGN KEY (user_id) REFERENCES users(user_id),
FOREIGN KEY (route_id) REFERENCES bus_routes(route_id))")
print("table created successfully!")
except Exception as e:
print("Error creating bookings table: " + str(e))
#table reviews
try:
mycursor.execute("CREATE TABLE IF NOT EXISTS review (user_id INT primary key,
route_id INT, rating INT, feedback VARCHAR(50), FOREIGN KEY (user_id)
REFERENCES users(user_id), FOREIGN KEY (route_id) REFERENCES
bus_routes(route_id))")
myconn.commit()
print("Table created successfully!")
except Exception as e:
print("Error creating reviews table:", str(e))
def insertdata():
17
900)")
mycursor.execute("INSERT INTO bus_routes (route_id, bus_number, source, destination,
departure_time, charges) VALUES (13, '4890', 'Rajasthan', 'Himachal', '07:30 ', 300)")
mycursor.execute("INSERT INTO bus_routes (route_id, bus_number, source, destination,
departure_time, charges) VALUES (14, '4597', 'Rajasthan', 'Madhya Pradesh', '08:00 ',
350)")
mycursor.execute("INSERT INTO bus_routes (route_id, bus_number, source, destination,
departure_time, charges) VALUES (15, '4568', 'Rajasthan', 'Haryana', '08:30 ', 400)")
mycursor.execute("INSERT INTO bus_routes (route_id, bus_number, source, destination,
departure_time, charges) VALUES (16, '6385', 'Bihar', 'Jharkhand', '09:00 ', 450)")
mycursor.execute("INSERT INTO bus_routes (route_id, bus_number, source, destination,
departure_time, charges) VALUES (17, '4567', 'Bihar', 'Odisha', '09:30 ', 500)")
mycursor.execute("INSERT INTO bus_routes (route_id, bus_number, source, destination,
departure_time, charges) VALUES (18, '9876', 'Bihar', 'West Bengal', '08:00 ', 550)")
mycursor.execute("INSERT INTO bus_routes (route_id, bus_number, source, destination,
departure_time, charges) VALUES (19, '5555', 'Madhya Pradesh', 'Delhi', '08:30 ', 600)")
mycursor.execute("INSERT INTO bus_routes (route_id, bus_number, source, destination,
departure_time, charges) VALUES (20, '3456', 'Madhya Pradesh', 'Rajasthan', '09:00 ',
650)")
myconn.commit()
print("Data inserted into bus_routes table successfully!")
except Exception as e:
18
print("Error inserting data into bus_routes table:", e)
# Functions
# 1. function to display routes
def display_routes():
mycursor.execute("SELECT * FROM bus_routes")
routes = mycursor.fetchall()
for i in routes:
print("Route ID: " + str(i[0]) + ", Bus Number: " + str(i[1]) + ", Source: " + str(i[2]) + ",
Destination: " + str(i[3]) + ", Departure Time: " + str(i[4]) + ", Charges: " + str(i[5]))
except Exception as e:
print("Error booking ticket:", e)
19
mycursor.execute("""
SELECT b.booking_id, r.bus_number, r.departure_time, r.source, r.destination, r.charges
FROM bookings b, bus_routes r
WHERE b.route_id = r.route_id
AND b.user_id = %s
""", (user_id,))
receipts = mycursor.fetchall()
for receipt in receipts:
print("Booking ID: " + str(receipt[0]) + ", Bus Number: " + str(receipt[1]) + ", Departure
Time: " + str(receipt[2]) + ", Source: " + str(receipt[3]) + ", Destination: " + str(receipt[4])
+ ", Charges: " + str(receipt[5]))
except Exception as e:
print("Error canceling booking:", e)
20
def add_review(user_id, route_id, rating, feedback):
try:
mycursor.execute("INSERT INTO review (user_id, route_id, rating, feedback) VALUES
(%s, %s, %s, %s)", (user_id, route_id, rating, feedback))
myconn.commit()
print("Thank you! Review submitted!")
except Exception as e:
print("Error adding review:", e)
21
while True:
print('''\n\n\t\t-------------------------------- \n\t\tchoose which function to perform \n\t\t-----------
----------------------\n\n''')
print("1. create new user ")
print("2. Display Routes")
print("3. Book Ticket")
print("4. Show Receipts")
print("5. Cancel Booking")
print("6. Add Review")
print("7. Quit")
if choice==1:
user_id = int( input('enter user id : '))
username=input('enter username: ')
password = int( input('enter password: '))
is_staff =input('are you a staff member ? (y/n): ')
new_user(user_id ,username , password , is_staff)
elif choice == 2:
display_routes()
elif choice == 3:
display_routes()
route_id = int(input("Enter the route ID to book: "))
22
payment_method = input("Enter payment method (UPI/Credit Card/Debit
Card/Wallets/Phone Pay/On Site): ")
user_id = int(input('enter user id : '))
booking_id = int(input('enter booking id : '))
book_ticket(booking_id, user_id,route_id, payment_method)
elif choice == 4:
show_receipts(user_id)
elif choice == 5:
booking_id = int(input("Enter the booking ID to cancel: "))
cancel_booking(booking_id) #delete from table
elif choice == 6:
display_routes()
route_id = int(input("Enter the route ID to review: "))
rating = int(input("Enter rating (1-5): "))
feedback = input("Enter feedback: ")
add_review(user_id, route_id, rating, feedback)# display booking table
elif choice == 7:
break
else:
print("\n\n\t\t#################################\n\t\tInvalid choice. Please try
again\n\t\t#################################")
23
Output Screens
24
25
26
27
User Manual
Main Menu Options: Upon launching the program, the main menu offers
the following choices:
1. Admin Login
2. Customer Login
3. Exit
Admin Login:
• Upon selecting "Admin Login," the system prompts for admin
credentials.
• On successful login, the admin gains access to the following
functionalities:
1. Add New Route:
• Enables addition of a new bus route, including route details and
charges.
2. Display Routes:
• Shows a list of available bus routes with their details like IDs,
numbers, sources, destinations, times, and charges.
3. Book Ticket:
• Allows booking a bus ticket by selecting a route, specifying a user
ID, and choosing a payment method.
4. Show Receipts:
• Displays booking receipts for a specific user, detailing booked
routes, times, sources, destinations, and charges.
5. Cancel Booking:
• Allows cancellation of a booked ticket by providing the booking
ID.
28
6. Add Review:
• Permits users to submit reviews for specific routes, including user
ID, route ID, ratings, and feedback.
7. Exit:
• Exits the admin module.
Customer Login:
• Upon selecting "Customer Login," users are granted access to the
following functionalities:
1. Display Routes:
• Shows available bus routes with details like IDs, numbers, sources,
destinations, times, and charges.
2. Book Ticket:
• Allows booking a bus ticket by selecting a route, specifying a user
ID, and choosing a payment method.
3. Show Receipts:
• Displays booking receipts for a specific user, detailing booked
routes, times, sources, destinations, and charges.
4. Cancel Booking:
• Allows cancellation of a booked ticket by providing the booking
ID.
5. Add Review:
• Permits users to submit reviews for specific routes, including user
ID, route ID, ratings, and feedback.
6. Exit:
• Exits the customer module.
Exit:
• Choosing "Exit" exits the program.
29
Bibliography
Websites:
1) https://www.w3schools.com
2) https://www.python.org
3) https://www.mysqltutorial.org
Books:
1) Computer science with python by Sumita Arora
2) Computer science with python by Preeti Arora
30