0% found this document useful (0 votes)
7 views

Bus Booking Mgmt System

Uploaded by

Nishant Raghav
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)
7 views

Bus Booking Mgmt System

Uploaded by

Nishant Raghav
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/ 29

Vandana International School

Academic Session:2024-25

Project Report
on
“Bus Booking Management System”
(For AISSCE 2024-25 Examination)

Submitted by- Project Guide -


Roll No: Ms. Madhu Sehgal
Name: PGT(Computer Science)
Class: XII
Subject: Computer Science
Subject Code: 083
Certificate
This is to certify that ___________of Class XII,

Vandana International School, has successfully developed

his/her Computer Science Project titled “Bus Booking

Management System”, under my supervision. The work

done by him/her is original and is submitted for the

AISSCE(Session 2024-25) as prescribed by CBSE.

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.

I express my heartfelt gratitude to my parents for constant encouragement while


carrying out this project. I gratefully acknowledge the contribution of the individuals
who contributed in bringing this project up to this level, who continues to look after me
despite my flaws, The guidance and support received from all the members who
contributed and who are contributing to this project, was vital for the success of the
project. I am grateful for their constant support and help.
Index
S. No. Title Page Nos.

1. Introduction to the Project 6

2. Objective & Scope of the Project 7

3. Hardware and Software Requirements 9

4. Modules and Functions used 10

5. Database and Tables used 13

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.

For passengers, this system presents an intuitive and user-centric interface,


empowering them to effortlessly explore available routes, book tickets,
leave valuable reviews, and execute various essential operations.

It simplifies the ticket booking process by providing a detailed catalogue


of available bus routes, complete with departure times, destinations, and
fare details. Users can confidently make informed decisions and swiftly
proceed through the booking process, ensuring a hassle-free and expedited
experience.

Conversely, the program bounds an admin module designed to empower


administrators in efficiently overseeing the bus booking system.

Administrators wield the capability to seamlessly incorporate new routes,


update existing route details, and remove outdated information from the
system.

Moreover, administrators can actively manage user reviews, fostering an


environment for continuous improvement based on valuable customer
feedback.

6
OBJECTIVES AND SCOPE OF
THE PROJECT

The primary objective of this project is to create an efficient and user-friendly


system for bus ticket management. Specific objectives include:

1. User Convenience: Provide users with an easy-to-use interface for


browsing available routes, booking tickets, and managing bookings.

2. Database Management: Implement a robust database structure using


MySQL to store essential information about routes, bookings, users, and
reviews.

3. Functional Efficiency: Develop and implement various


functions/modules to handle tasks such as booking tickets, displaying
routes, managing user accounts, and handling reviews seamlessly.

4. Staff Accessibility: Facilitate staff members with tools to manage


bookings, review user feedback, and maintain the database effectively.

5. Security Measures: Ensure data security and privacy by implementing


secure user authentication and authorization protocols.

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.

By considering these potential improvements, the Bus Booking Management


System could evolve into a more comprehensive and user-centric platform, catering
to a broader audience and enhancing the overall travel experience

8
Hardware and Software
Specifications
HARDWARE REQUIREMENTS

I. PROCESSOR : Intel CORE i5

II. RAM : 8GB

III. Hard disk : 1 TB

IV. CD/DVD r/w multi drive combo: Pen-drive

V. Printer : LaserJet

SOFTWARE REQUIREMENTS:

I. OPERATING SYSTEM : WINDOWS 10

II. PROGRAMMING LANGUAGE : Python 3.10.2


III. RDBMS : MySQL Server and Client

9
Modules and Functions Used

Front end: The front end was designed using Python.

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.

Back end: The backend was designed using MySQL.


MySQL is a relational database management system (RDBMS) developed by
Oracle that is based on structured query language (SQL).MySQL is integral to
many of the most popular software stacks for building and maintaining
everything from customer-facing web applications to powerful, data-driven
B2B services. Its open-source nature, stability, and rich feature set.

10
Following modules are used in this project:

• mysql.connector : MySQL Connector/Python enables Python programs to


access MySQL databases, using an API that is compliant with the Python
Database API Specification v2.0 (PEP 249). It is written in pure Python
and does not have any dependencies except for the Python Standard
Library.

Following functions have been used in the 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.

4.book_ticket(booking_id, user_id, route_id, payment_method):

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.

7.add_review(user_id, route_id, rating, feedback):

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.

8.new_user(user_id, username, password, is_staff):

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():

# Insert data into bus_routes table


try:
mycursor.execute("INSERT INTO bus_routes (route_id, bus_number, source, destination,
departure_time, charges) VALUES (1, '1001', 'Delhi', 'Himachal', '10:00 ', 500)")
16
mycursor.execute("INSERT INTO bus_routes (route_id, bus_number, source, destination,
departure_time, charges) VALUES (2, '1234', 'Delhi', 'Haryana', '11:00 ', 700)")
mycursor.execute("INSERT INTO bus_routes (route_id, bus_number, source, destination,
departure_time, charges) VALUES (3, '1342', 'Delhi', 'Karnataka', '12:00 ', 450)")
mycursor.execute("INSERT INTO bus_routes (route_id, bus_number, source, destination,
departure_time, charges) VALUES (4, '4567', 'Punjab', 'Himachal', '01:00 ', 500)")
mycursor.execute("INSERT INTO bus_routes (route_id, bus_number, source, destination,
departure_time, charges) VALUES (5, '4456', 'Punjab', 'Rajasthan', '02:00 ', 550)")
mycursor.execute("INSERT INTO bus_routes (route_id, bus_number, source, destination,
departure_time, charges) VALUES (6, '3556', 'Punjab', 'Madhya Pradesh', '03:00 ', 600)")
mycursor.execute("INSERT INTO bus_routes (route_id, bus_number, source, destination,
departure_time, charges) VALUES (7, '4567', 'Kerala', 'Tamil Nadu', '04:00 ', 650)")
mycursor.execute("INSERT INTO bus_routes (route_id, bus_number, source, destination,
departure_time, charges) VALUES (8, '5678', 'Kerala', 'Karnataka', '05:00', 700)")
mycursor.execute("INSERT INTO bus_routes (route_id, bus_number, source, destination,
departure_time, charges) VALUES (9, '5689', 'Kerala', 'Telangana', '05:30 ', 750)")
mycursor.execute("INSERT INTO bus_routes (route_id, bus_number, source, destination,
departure_time, charges) VALUES (10, '3587', 'Andhra Pradesh', 'Tamil Nadu', '06:00
800)")
mycursor.execute("INSERT INTO bus_routes (route_id, bus_number, source, destination,
departure_time, charges) VALUES (11, '4578', 'Andhra Pradesh', 'Madhya Pradesh', '06:30
', 850)")
mycursor.execute("INSERT INTO bus_routes (route_id, bus_number, source, destination,
departure_time, charges) VALUES (12, '3468', 'Andhra Pradesh', 'Karnataka', '07:00 ',

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]))

# 2. function to book ticket


def book_ticket(booking_id,user_id, route_id, payment_method):
try:
mycursor.execute("INSERT INTO bookings (booking_id,user_id, route_id,
payment_method, payment_status) VALUES (%s,%s, %s, %s, %s)", (booking_id,user_id,
route_id, payment_method, 'N'))
myconn.commit()
print("Booking successful!")

except Exception as e:
print("Error booking ticket:", e)

# 3. function to show receipts


def show_receipts(user_id):

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]))

# 4.function to cancel bookings


def cancel_booking(booking_id):
try:
mycursor.execute("DELETE FROM bookings WHERE booking_id = %s", (booking_id,))
myconn.commit()
print("Booking canceled!")

except Exception as e:
print("Error canceling booking:", e)

# 5. function to add review

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)

#6. new user


def new_user(user_id ,username , password , is_staff):
try:
mycursor.execute("INSERT INTO users (user_id, username , password , is_staff )
VALUES (%s, %s, %s, %s)", (user_id, username , password , is_staff))
myconn.commit()
print("you are logged in!")
except Exception as e:
print("Error creating user:", e)

# Main program loop


create_tables()
insertdata()
user_id = 1 # Assuming the user is already logged in

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")

choice = int(input("Enter your choice: "))

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

You might also like