0% found this document useful (0 votes)
3 views15 pages

Computer Science Project

This document presents a bus reservation system project developed using Python by Aarav Shukla for the academic session 2025-2026. It includes an acknowledgment section, project objectives, software used, and the complete program code for the system, which allows users to view available buses, book tickets, check PNR status, and cancel bookings. The project aims to enhance understanding of Python programming and implement a real-life application in a menu-driven format.

Uploaded by

jaisalmermerme
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views15 pages

Computer Science Project

This document presents a bus reservation system project developed using Python by Aarav Shukla for the academic session 2025-2026. It includes an acknowledgment section, project objectives, software used, and the complete program code for the system, which allows users to view available buses, book tickets, check PNR status, and cancel bookings. The project aims to enhance understanding of Python programming and implement a real-life application in a menu-driven format.

Uploaded by

jaisalmermerme
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

COMPUTER SCIENCE PROJECT

BUS RESERVATION SYSTEM


USING PYTHON

Submitted By: Aarav Shukla


Class: XI Section: D
Session: 2025–2026
ACKNOWLEDGEMENT

I would like to express my sincere gratitude to my Computer


Science teacher, Ms. Neeru Nigam, for her constant guidance,
valuable suggestions, and encouragement throughout the
completion of this project. Her support helped me understand
Python programming concepts clearly and effectively. I am
also thankful to our respected Principal, Ms. Manisha
Anthwal, for providing a supportive learning environment and
the necessary facilities to carry out this project successfully. I
would also like to thank my parents and friends for their
continuous motivation and support.
Index

[Link]. CONTENTS

1. ACKNOWLEDGEMENT

2. OBJECTIVE

3. SOFTWARE USED

4. PROGRAM

5. OUTPUTS
OBJECTIVE

• To learn Python programming


• To understand menu-driven programs
• To implement a real-life reservation system

SOFTWARE USED: Python IDLE


PROGRAM

import random
import datetime
buses = {
1: {"route": "Mumbai → Pune", "departure": "07:00 AM", "seats": 40, "fare":
550, "booked": 0},
2: {"route": "Delhi → Jaipur", "departure": "08:00 AM", "seats": 45, "fare":
600, "booked": 0},
3: {"route": "Bengaluru → Chennai", "departure": "06:00 AM", "seats": 50,
"fare": 700, "booked": 0}
}
bookings = {}
run = 1
while run == 1:
print("\n========== BUS SERVICES ==========")
print("1. Show Available Buses")
print("2. Show Available Seats in a Bus")
print("3. Book Ticket")
print("4. Check PNR Status")
print("5. Cancel Ticket")
print("6. Exit")
service = input("Select Service: ")
if service == "1":
print("\nID | Route | Departure | Seats | Fare")
print("------------------------------------------------------")
for i, b in [Link]():
available = b["seats"] - b["booked"]
print(str(i) + " " + b["route"] + " " +
b["departure"] + " " + str(available) +
" ₹" + str(b["fare"]))
elif service == "2":
bus_id = input("Enter Bus ID: ")
if bus_id == "1" or bus_id == "2" or bus_id == "3":
bus_id = int(bus_id)
bus = buses[bus_id]
available = bus["seats"] - bus["booked"]
print("\nRoute: " + bus["route"])
print("Departure: " + bus["departure"])
print("Available Seats: " + str(available))
else:
print("Invalid Bus ID!")
elif service == "3":
print("\nAvailable Buses:\n")
for i, b in [Link]():
available = b["seats"] - b["booked"]
print(str(i) + ". " + b["route"] + " | " +
b["departure"] + " | Seats: " +
str(available) + " | Fare: Rs." + str(b["fare"]))
bus_id = input("\nEnter Bus ID: ")
if bus_id == "1" or bus_id == "2" or bus_id == "3":
bus_id = int(bus_id)
bus = buses[bus_id]
available = bus["seats"] - bus["booked"]
if available > 0:
name = input("Enter Passenger Name: ")
seats = int(input("How many seats?: "))
if seats <= available:
bus["booked"] += seats
amount = seats * bus["fare"]
pnr = "PNR" + str([Link](100000, 999999))
bookings[pnr] = {
"name": name,
"bus": bus_id,
"seats": seats,
"amount": amount,
"date": str([Link]()),
"status": "ACTIVE"
}
print("\n=== Ticket Booked Successfully ===")
print("PNR: " + pnr)
print("Passenger: " + name)
print("Route: " + bus["route"])
print("Seats: " + str(seats))
print("Total Fare: ₹" + str(amount))
print("Date: " + bookings[pnr]["date"])
else:
print("Not enough seats!")
else:
print("No seats available!")
else:
print("Invalid Bus ID!")
elif service == "4":
pnr = input("Enter PNR: ")
if pnr in bookings:
t = bookings[pnr]
bus = buses[t["bus"]]
print("\nPNR: " + pnr)
print("Passenger: " + t["name"])
print("Route: " + bus["route"])
print("Seats: " + str(t["seats"]))
print("Amount Paid: Rs." + str(t["amount"]))
print("Date: " + t["date"])
print("Status: " + t["status"])
else:
print("Invalid PNR!")
elif service == "5":
pnr = input("Enter PNR to cancel: ")
if pnr in bookings:
t = bookings[pnr]
if t["status"] == "CANCELLED":
print("This ticket is already cancelled.")
else:
buses[t["bus"]]["booked"] -= t["seats"]
t["status"] = "CANCELLED"
print("\nTicket Cancelled!")
print("Refund: Rs." + str(t["amount"]))
else:
print("Invalid PNR!")
elif service == "6":
print("Thank you for using Bus Services!")
run = 0
else:
print("Invalid Option!")
OUTPUTS

1. Show Available Buses:

2. Available Seats in a Bus:


3. Ticket Booking Output:

4. PNR Status Output:


5. Ticket Cancellation Output:

[Link];
THANK
YOU!!!!

You might also like