Computer Science Project File Manikant
Computer Science Project File Manikant
POORVA DWIVEDI
MANIKANT CHAUDHARY
MANIKANT CHAUDHARY
def connect_to_database():
try:
except con.Error as e:
exit()
dbo = connect_to_database()
co = dbo.cursor()
def new_user():
print("-" * 70)
print("-" * 70)
dbo.commit()
# FORGOT USER ID
def forgot_user_id():
emel = co.fetchall()
for i in emel:
def old_user():
print("-" * 70)
if co.fetchone() is None:
if choice == 1:
old_user()
elif choice == 2:
forgot_user_id()
elif choice == 3:
new_user()
else:
if pas == co.fetchone()[0]:
passenger_panel(uid)
def admin_password():
if password == "ADMIN123":
print("Access Granted.")
admin_panel()
else:
admin_password()
# ADD BUS
def add_bus():
print("-" * 70)
co.execute("INSERT INTO bus_schedule VALUES ({}, '{}', '{}', '{}', '{}', {},
{})".format(bus_no, name, origin, destination, journey_time, seats, fare))
print("Bus added successfully!")
dbo.commit()
# SEARCH BUS
def search_bus():
buses = co.fetchall()
# BOOK TICKETS
def book_ticket(uid):
search_bus()
fare = co.fetchone()[0]
for _ in range(seats):
print("Booking confirmed!")
dbo.commit()
# CANCEL TICKET
def cancel_ticket():
dbo.commit()
# PASSENGER PANEL
def passenger_panel(uid):
while True:
if choice == 1:
search_bus()
elif choice == 2:
book_ticket(uid)
elif choice == 3:
cancel_ticket()
elif choice == 4:
print("Logging out.")
break
# ADMIN PANEL
def admin_panel():
while True:
if choice == 1:
add_bus()
elif choice == 2:
print("Logging out.")
break
# MAIN MENU
def main_menu():
try:
while True:
if choice == 1:
admin_password()
elif choice == 2:
new_user()
elif choice == 3:
break
except Exception as e:
exit()
# Entry point
if __name__ == "__main__":
main_menu()
OUTPUTS
1.Bus Reservation Main Page
********WELCOME TO BUS RESERVATION SYSTEM********
1. Admin Panel
2. Passenger Panel
3. Exit
******************Access Granted********************
---------------------------------------------------------------------
1. Add Bus
2. Logout
3. Add Bus
# for choice = 1 min admin panel
1. Search Bus
2. Book Ticket
3. Cancel Ticket
4. Logout
5. Search Bus
# for choice = 1 in passenger panel
Booking confirmed!
6. Booking Tickets
Enter the bus number you want to book: 101 # for choice = 2 in passenger panel
Booking confirmed!
7. Cancel Ticket
# for choice = 3 in passenger panel