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

Apu Computer

This document is a certificate and project report for a student's computer project titled "Bus Management System". The certificate recognizes the student's successful completion of the project for the 2023-2024 academic year. The project report includes an introduction, objectives, key points, life cycle, algorithms, goals, requirement gathering, and outlines for other sections like user interface development, testing, and features. It was completed diligently and demonstrates the student's commitment to academic excellence.

Uploaded by

Shanmukh B
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Apu Computer

This document is a certificate and project report for a student's computer project titled "Bus Management System". The certificate recognizes the student's successful completion of the project for the 2023-2024 academic year. The project report includes an introduction, objectives, key points, life cycle, algorithms, goals, requirement gathering, and outlines for other sections like user interface development, testing, and features. It was completed diligently and demonstrates the student's commitment to academic excellence.

Uploaded by

Shanmukh B
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

New Baldwin International

Senior Secondary School


Title : The Bus Management System

Session Date: 2023 to 2024

Name: Apurv Kumar Singh


CERTIFICATE

This is to certify that Apurv Kumar Singh has


successfully completed the Computer Investigatory
Project titled "Bus Management System" for the
session 2023-2024 at New Baldwin International
Senior Secondary School.

The project was carried out with diligence and


demonstrates Apurv Kumar Singh commitment to
academic excellence and scientific exploration. We
applaud the effort and understanding shown in this
project.

Signature of principalSignature of Internal


Examiner:Signature of External Examiner:
[Signature] [Signature] [Signature]
ACKNOWLEDGEMENT

I want to express my heartfelt thanks to our


Management, our principal Ms.Ambika, as well as
our computer faculty Ms.Grace . My friends have
been a big source of support and motivation. They
provided feedback and cheered me on, pushing me
to do my best.

My family was there for me with constant


encouragement and understanding. They helped in
countless ways, making it possible for me to work on
this project. Their faith in me was a big source of
strength.

My teachers and mentors played a crucial role too.


They shared their knowledge and guidance, helping
me stay on the right track and make this project a
success.
This project's success is because of all these
amazing people. Their contributions, advice, and
belief in me made it happen.
INDEX
TOPICS Pg no
> Introduction 5

> Key points 6

> Life cycle 7

> Algorithm 9

> Project Goals 11

> Requirement Gathering 14

> User interface development 16

> Security Implementation 18

> Testing 20

> Features 22

> Data structure 24

> Flow Diagram 26

> Source Code 27

> Sample Output 32

> Bibliography 33
INTRODUCTION

This chapter will briefly describe the Bus


Management System (BMS).
This is one of proposed solutions that can be used by
many express bus companies especially in India.
Major aspects that will be discussed include
background of the system, problem statement,
objectives of the project and scope of the project.
A bus management system is a comprehensive
platform designed to streamline and optimize the
operations of bus transportation services.
It integrates technology to efficiently manage various
aspects
of bus fleets, scheduling, passenger information,
ticketing, and overall administration.
By employing innovative solutions, it aims to
enhance the
overall efficiency, safety, and convenience of public or
private bus services.
OBJECTIVE

Objective 1: User Authentication


-Implement user registration and login
functionality for secure access.
Objective 2: Expense Logging
-Allow users to log daily expenses with details
like date, category, and amount.
Objective 3: Expense Analytics
-Visualize spending patterns through graphs
and charts. Objective 4: Budget Management
-Enable users to set monthly budgets, receive
notifications on exceeding limits.
Objective 5: Data Security
-Ensure secure storage and handling of user
data.
Objective 6: Export and Import
-Allow users to export/import expense data for
data portability.
Objective 7: Responsive Design
-Create a responsive and user-friendly interface.
Objective 8: Expense Insights
-Implement algorithms to analyze spending
habits for insights.
Key points
1. Fleet Tracking and Management: Utilizes GPSand
other technologies to track buses in real-time,
enabling efficient fleet management, route
optimization, and monitoring of vehicle performance.

2. Route Planning and Optimization: Determines the


most efficient routes based on factors like
traffic,demand, and time schedules, reducing fuel
consumption and enhancing on-time performance.

3.Passenger Information Systems: Provides real-time


updates to passengers regarding bus schedules,
arrivals, delays, and other relevant information
through various channels like mobile apps, websites,
or digital displays at bus stops.

4. Ticketing and Payment Solutions: Offers


convenient ticket purchasing options through mobile
apps, online platforms, or automated kiosks, allowing
passengers to pay digitally and reducing the need for
physical transactions.
Life cycle

1. Planning and Analysis: This phase involves


identifying the need for a bus management system,
understanding requirements, and conducting a
feasibility study. It includes analyzing existing
infrastructure, technology, budget considerations, and
stakeholder needs.

2. Design: In this stage, the system architecture,


functionalities, and user interfaces are designed
based on the identified requirements. It includes
creating specifications, wireframes, and prototypes to
outline how the system will function.

3. Development: The actual construction of the bus


management system takes place in this phase.
Software developers and engineers build the system
according to the design specifications, integrating
various modules, databases, and functionalities.

4. Testing: Comprehensive testing is crucial to


ensure the system operates accurately and reliably.
This phase involves various testing methods, such as
unit testing, integration testing, system testing, and
user acceptance testing, to identify and rectify any
issues or bugs.
5. Deployment: Once the system passes testing and
receives approval, it is deployed for use. This involves
installing the system, training staff, and ensuring a
smooth transition from any previous systems or
procedures.

6. Operation and Maintenance: The system is


actively used in this phase, and ongoing maintenance
is necessary to ensure its optimal performance.
Regular updates, patches, and improvements are
made to address issues, enhance features, and adapt
to changing requirements.

7. Evaluation and Optimization: Continuous


evaluation of the system's performance against
predefined metrics is essential. Feedback from users,
data analysis, and monitoring help identify areas for
improvement or optimization to enhance efficiency
and address evolving needs.
Algorithm

Booking a Seat Algorithm:


Objective:
Allow users to book a seat on a bus.
Algorithm:
User Input:
Receive the bus number for booking. Display
available seats and prompt the user to enter the seat
number.
Availability Check:
Retrieve the bus's capacity and the number of
booked seats from the database. Verify that the
entered seat number is within the available range.
Booking Process:
If the seat is available, insert a new record in the
'bookings' table with the bus number and seat
number.

Pseudocode:
python
Copy code
function bookSeat():
bus_number = input("Enter bus number for

booking: ") displaySeatAvailability(bus_number)

seat_to_book = input("Enter the seat number to

book:")

booked_seats = getBookedSeatsCount(bus_number)
capacity = getBusCapacity(bus_number)

if 0 < seat_to_book <= (capacity - booked_seats):


insertBookingRecord(bus_number, seat_to_book)
updateBookedSeatsCount(bus_number,
booked_seats+ 1) print("Seat booked successfully!")
else: print("Invalid seat number or seat already
booked.")

Update Bus Capacity Algorithm:


Objective:

Allow users to update the capacity of a bus.


Algorithm:
User Input:
Receive the bus number for which the
capacity needs to be updated.
Prompt the user to enter the new capacity.
Update Process:
Update the 'buses' table with the new
capacity for the specified bus number.
Pseudocode:
function
updateBusCapacity():
bus_number = input("Enter bus number to update
capacity:
")
new_capacity = input("Enter new capacity: ")

updateBusCapacityInDatabase(bus_number,
new_capacity) print("Bus
capacity updated!")

function updateBusCapacityInDatabase(bus_number,
new_capacity):
// Connect to the database
// Update the 'buses' table with the new capacity
for the specified bus number
Project goals

1. Enhanced Efficiency: Streamlining operations to


maximize the utilization of resources, minimize
downtime, and optimize routes for fuel efficiency and
time savings.

2. Improved Service Quality: Providing a reliable


and punctual bus service through better scheduling,
real-time tracking, and accurate information
dissemination to passengers.

3. Cost Optimization: Reducing operational costs by


optimizing routes, minimizing fuel consumption, and
efficiently managing maintenance schedules to
prolong the lifespan of vehicles.

4. Enhanced Passenger Experience: Offering


convenience to passengers through user-friendly
interfaces, accurate real-time information on bus
schedules, and easy ticketing options via mobile apps
or online platforms.

5. Safety and Compliance: Ensuring adherence to


safety standards, driver compliance, and regulatory
requirements
Requirement Gathering

1. Stakeholder Identification: Identify all


stakeholders involved in bus management, such as
transportation authorities, fleet managers, drivers,
maintenance staff, ticketing personnel, and
passengers.

2. Regulatory and Compliance Requirements:


Identify legal and regulatory requirements related to
transportation, safety standards, data protection, and
privacy.

3. Prioritization and Validation: Prioritize gathered


requirements based on their importance and
feasibility. Validate these requirements with
stakeholders to ensure they accurately represent their
needs.

4. Documentation: Document all gathered


requirements in a structured format, such as a
requirements traceability matrix, use cases, or user
stories.

5. Review and Iteration: Review the documented


requirements with stakeholders to ensure alignment
and make necessary iterations based on feedback
before proceeding to the design and development
phases.
User Interface Development

Technologies Used:

Frontend: HTML, CSS, Python (Flask or Django


for backend integration)
User Interaction: Standard Input/Output
(Console-based interface)

Key Features:

Console-Based Interface:
The user interacts with the system through a
console-based interface, ensuring simplicity
and ease of use.

Menu-Driven Navigation:
A menu-driven navigation system guides
users through various functionalities,
allowing them to perform actions like adding
buses, viewing all buses, updating capacity,
deleting buses, and booking seats.
Input Validation:
User inputs for critical operations such as
adding a bus, updating capacity, and
booking a seat are validated to ensure data
integrity and prevent invalid entries.

Displaying Bus Information:


The UI presents detailed information about
buses, including bus number, capacity, and
booking status.

.
Security Implementation

User authentication is implemented using the MySQL


database's built-in user management system.
Passwords are securely stored using hashing
algorithms to prevent unauthorized access.
Code
mydb =
mysql.connector.connect(host="localhost",
user="root", password=".....",
database="project") Data Validation:
User inputs are validated to prevent SQL injection
attacks and ensure that only valid data is processed.
Prepared statements are used in SQL queries to
sanitize user inputs.
Code:
sql = "INSERT INTO buses (bus_number, capacity)
VALUES
(%s, %s)" val =
(bus_number, capacity)

try:
cursor.execute(sql, val)
mydb.commit() print("Bus
added successfully!") except
mysql.connector.Error as err:
print(f"Error adding bus: {err}")

Data Encryption:

Sensitive information such as user passwords is


encrypted using secure cryptographic hashing
algorithms. Code Snippet: python
# Password storage during user registration
hashed_password
=hashlib.sha256(password.encode()).hexdigest()
Secure Connection:
Database connections are established securely,
ensuring the confidentiality of data during
transmission. Code Snippet: python
Copy code mydb =
mysql.connector.connect
(host="localhost",
user="root", password=""
database="project"
Testing

1. Unit Testing:
- Bus Class: Test individual methods/functions
within the Bus class.
- Test bus initialization with proper attributes.
- Test methods like
add_passenger(),remove_passenger(),
update_location(), etc., for expected behavior.

2. Integration Testing:
- Database Connectivity: Test database
connections and
CRUD (Create, Read, Update, Delete) operations.
Ensure data is stored, retrieved, and updated
correctly.
- API Endpoints: If your code interacts with external
APIs
(for tracking or data retrieval), test the endpoints'
functionality and response handling.

3. Functional Testing:
- Use Case Scenarios: Test the code against
various use case scenarios to ensure it meets
functional requirements.
For example:
- Simulate bus route planning and validate the
output against expected routes and schedules.
- Simulate passenger booking, tracking, and
cancellation processes to verify correct system
responses.

4. Error Handling:
- Boundary Conditions: Test the code with edge
cases, invalid inputs, or unexpected scenarios to
ensure it handles errors gracefully without
crashing.
- Exception Handling: Verify that exceptions and
errors are caught, logged appropriately, and do
not cause system
instability.

5. Performance Testing:
- Load Testing: If applicable, simulate
heavy usage scenarios to check how the
system handles increased load and verify
response times.
- Resource Utilization: Monitor memory
usage, CPU usage, and other resources
during different operations to ensure
efficiency.

6. User Acceptance Testing (UAT):


- If possible, involve end-users (administrators,
drivers, or passengers) to test the system in a
real-world scenario. Gather feedback on usability,
functionality, and any issues encountered.

FEATURES

1. Bus Class Management:


- Create a Bus class to manage individual buses
with attributes like bus number, capacity, current
location, and passenger list.
- Methods to add passengers, remove passengers,
update bus location, and display bus information.
python class Bus: def __init__(self,
bus_number, capacity):
self.bus_number = bus_number
self.capacity = capacity
self.current_location = ""
self.passengers = [] def
add_passenger(self,
passenger):
# Add passenger to the bus if there's
space if len(self.passengers) <
self.capacity:
self.passengers.append(passenger)
return True Else:
return False
def remove_passenger(self, passenger):
# Remove passenger from the
bus if passenger in
self.passengers:
self.passengers.remove(passen
ger) return True Else:
return False def
update_location(self,
location):
# Update bus location
self.current_location = location
def display_info(self):
# Display bus information
print(f"Bus Number:
{self.bus_number}")
print(f"Capacity: {self.capacity}")
print(f"Current Location: {self.current_location}")
print(f"Passengers: {', '.join(self.passengers)}")

2. Route Planning and Management:


- Implement functionality to create, modify, and
optimize bus routes based on factors like traffic,
stops, and schedules.

3. Passenger Booking and


Management:
- Develop a system for passengers to book seats,
cancel bookings, and view available buses and
schedules.

4. Real-time Tracking and


Monitoring:
- Utilize APIs or simulate real-time updates to track
buses' current locations and provide accurate
arrival/departure times to passengers.
5. Database Integration:
- Connect the system to a database to store bus
information, schedules, passenger details, and
booking records.
Database Structure

Buses Table:
Stores information about each bus in the fleet.
Columns:
bus_id (Primary Key): Unique identifier for
each bus. bus_number: The identifying
number for the bus.
capacity: Maximum number of seats on the
bus.

Code:
CREATE TABLE buses
( bus_id INT AUTO_INCREMENT
PRIMARY KEY, bus_number
VARCHAR(255) NOT NULL, capacity
INT NOT NULL) Bookings Table:
Records information about seat bookings for
each bus.
Columns: booking_id (Primary Key):
Unique identifier for each booking.
bus_number (Foreign Key): References the
bus_id from the buses table.
seat_number: The seat number booked.
Code:
CREATE TABLE bookings
(booking_id INT AUTO_INCREMENT
PRIMARY KEY, bus_number
VARCHAR(255), seat_number INT,
FOREIGN KEY (bus_number) REFERENCES
buses(bus_id)) Sample Data:

Code:
INSERT INTO buses (bus_number, capacity)
VALUES
('BUS001', 50),
('BUS002', 40),
('BUS003', 60);

Bookings Table:

Code:
INSERT INTO bookings (bus_number, seat_number)
VALUES
('BUS001', 10),
('BUS001', 15),
('BUS002', 5),
('BUS003', 30);
Relationships:
One-to-Many Relationship (Buses to Bookings):
Each bus in the buses table can have
multiple entries in the bookings table.
Indexing:
Index on bus_number in the buses table:
To optimize searches based on the bus number.
Code:
CREATE INDEX idx_bus_number ON
buses(bus_number);

Flow diagram
Start
User --> Login Screen --> Authenticate Credentials -->
Dashboard
----> Invalid Credentials --> Error Message
----> Register --> User Details --> Dashboard
Dashboard --> View Routes --> Fetch Routes from
Database
–--> Display Routes
----> Book Bus --> Select Bus --> Confirm Booking -->
Generate Ticket
----> Payment --> Update Database (Transaction
Record)
----> Success --> Confirmation Message
----> Cancel Booking --> Update Database
(Cancellation) -->
Refund --> Confirmation Message
----> Track Bus --> Enter Bus Number --> Fetch
Location from
Database --> Display Location

Admin Dashboard --> Manage Buses --> Add Bus -->


Enter Details --> Save Details to Database
----> Update Bus --> Select Bus --> Modify Details -->
Save Changes to Database
----> Manage Routes --> Add Route --> Enter Stops -->
Save Route to Database
----> Update Route --> Select Route --> Modify Stops -
->
Save Changes to Database
SOURCE CODE

import mysql.connector

# Establish connection mydb


= mysql.connector.connect(
host="localhost",
user="root",
password="",
database="project"
)

cursor = mydb.cursor()

def add_bus():
bus_number = input("Enter bus number: ")
capacity = input("Enter capacity: ")

sql = "INSERT INTO buses (bus_number, capacity)


VALUES (%s, %s)" val =
(bus_number, capacity)

try:
cursor.execute(sql, val)
mydb.commit() print("Bus
added successfully!")
except mysql.connector.Error as err:
print(f"Error adding bus: {err}")
def view_all_buses():
try:
cursor.execute("SELECT * FROM
buses") result = cursor.fetchall() for
bus in result:
print(bus)
except mysql.connector.Error as err:
print(f"Error viewing buses: {err}")

def update_bus_capacity():
bus_number = input("Enter bus number to update
capacity:
")
new_capacity = input("Enter new capacity: ")

sql = "UPDATE buses SET capacity = %s WHERE


bus_number = %s" val =
(new_capacity, bus_number)

try:
cursor.execute(sql, val)
mydb.commit() print("Bus
capacity updated!")
except mysql.connector.Error as err:
print(f"Error updating bus capacity:
{err}")

def delete_bus():
bus_number = input("Enter bus number to delete: ")
sql = "DELETE FROM buses WHERE bus_number =
%s" val = (bus_number,)

try:
cursor.execute(sql,
val) mydb.commit()
print("Bus deleted!")
except mysql.connector.Error as err:
print(f"Error deleting bus: {err}")

def
display_seat_availability(bus_number
): try:
cursor.execute("SELECT capacity FROM buses
WHERE
bus_number = %s", (bus_number,))
capacity = cursor.fetchone()[0]

cursor.execute("SELECT COUNT(*) FROM


bookings
WHERE bus_number = %s", (bus_number,))
booked_seats = cursor.fetchone()[0]

available_seats = capacity - booked_seats


print(f"Available seats on bus {bus_number}:
{available_seats}/{capacity}") except
mysql.connector.Error as err: print(f"Error
displaying seat availability: {err}") def
book_seat():
bus_number = input("Enter bus number for booking:
")

try:
display_seat_availability(bus_number)
seat_to_book = int(input("Enter the seat number
to book:
"))

cursor.execute("SELECT COUNT(*) FROM


bookings
WHERE bus_number = %s", (bus_number,))
booked_seats = cursor.fetchone()[0]

cursor.execute("SELECT capacity FROM buses


WHERE
bus_number = %s", (bus_number,))
capacity = cursor.fetchone()[0]

if 0 < seat_to_book <= (capacity - booked_seats):


cursor.execute("INSERT INTO bookings (bus_number,
seat_number) VALUES (%s, %s)",
(bus_number, seat_to_book))
mydb.commit() print("Seat booked
successfully!")
else:
print("Invalid seat number or seat already
booked.")
except mysql.connector.Error as err:
print(f"Error booking seat: {err}")

def bus_management_system():
while True:
print("\nBus Management
System") print("1. Add Bus")
print("2. View All Buses")
print("3. Update Bus
Capacity") print("4. Delete
Bus") print("5. Book a Seat")
print("6. Exit") choice =
input("Enter choice: ")

if choice == '1':
add_bus()
elif choice == '2':
view_all_buses()
elif choice == '3':
update_bus_capacity()
elif choice == '4':
delete_bus()
elif choice == '5':
book_seat()
elif choice == '6':
break
else: print("Invalid choice. Please enter a
valid option.")

cursor.close()
mydb.close()
Sample Output
1. Add Bus
2. View All Buses
3. Update Bus Capacity
4. Delete Bus
5. Book a Seat
6. Exit

Enter choice: 1
Enter bus number: BUS001
Enter capacity: 50
Bus added
successfully!

Enter choice: 2
(Displays information about all buses)

Enter choice: 3
Enter bus number to update
capacity: BUS001 Enter new
capacity: 60 Bus capacity updated!

Enter choice: 4
Enter bus number to delete:
BUS001 Bus deleted!
Bibilography

Mozilla Developer Network (MDN) Web Docs:


MDN Web Docs. (n.d.). Retrieved
from
https://developer.mozilla.org/
W3Schools:
W3Schools. (n.d.). Retrieved
from https://www.w3schools.com/
Stack Overflow:
Stack Overflow. (n.d.). Retrieved
from https://stackoverflow.com/ MySQL
Documentation:
MySQL Documentation. (n.d.). Retrieved
from https://dev.mysql.com/doc/ Flask
Documentation:
Flask Documentation. (n.d.). Retrieved
from https://flask.palletsprojects.com/
Django Documentation:
Django Documentation. (n.d.). Retrieved
from https://docs.djangoproject.com/ GitHub
Guides:
GitHub Guides. (n.d.). Retrieved from
https://guides.github.com/

You might also like