0% found this document useful (0 votes)
12 views25 pages

ip project 2024-2025

The project report outlines the development of a Train Booking System utilizing Python and MySQL to enhance user experience in booking train tickets and managing snack preferences. It includes features such as secure user registration, login, and real-time data management for ticket bookings. Future enhancements may include real-time train tracking, machine learning for demand prediction, and a mobile application for on-the-go bookings.

Uploaded by

pabhijay4
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)
12 views25 pages

ip project 2024-2025

The project report outlines the development of a Train Booking System utilizing Python and MySQL to enhance user experience in booking train tickets and managing snack preferences. It includes features such as secure user registration, login, and real-time data management for ticket bookings. Future enhancements may include real-time train tracking, machine learning for demand prediction, and a mobile application for on-the-go bookings.

Uploaded by

pabhijay4
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
You are on page 1/ 25

A PROJECT REPORT ON

TRAIN BOOKING SYSTEM


Academic Year 2023-24

SUBMITTED BY : P.S.ABHIJAY

ROLL NO : ______________

NAME :
CLASS : XII( PCM)
SUBJECT : INFORMATICS PRACTICES

SUB CODE : 065

CERTIFICATE
This is to certify that student P.S.ABHIJAY with CBSE Roll No:
__________________________ has successfully completed the project work
entitled ‘TRAIN BOOKING’ in the subject Informatics Practices(065)
laid down in the regulations of CBSE for the purpose of Practical
Examination in Class XII during academic year 2024-2025.

Internal Examiner- External Examiner-

Name: Name:

Signature: Signature:

ACKNOWLEDGEMENT

2
We would like to express our sincere gratitude to our teacher and
project guide Ms. Tabbasum for guiding us through the course of
this project.

We would like to thank our parents for their unyielding support and
consideration leading to the successful completion of this project.

We would like to extend our deep gratitude to our friends and


classmates who took time out to help us with the ideologies of this
project.

Lastly, we would like to gratify all those who had directly or indirectly
helped with this project.

P.S.ABHIJAY

(Name of the student)

3
TABLE OF CONTENTS

DESCRIPTION PAGE NO
S.no

01 CERTIFICATE 01

02 ACKNOWLEDGEMENT 02

03 TABLE OF CONTENTS 03

04 INTRODUCTION 05

05 OBJECTIVES 06

06 WORKING 07

07 FUTURE SCOPE 08

08 SOURCE CODE 09

09 HARDWARE AND SOFTWARE REQUIREMENTS 21

10 BIBLIOGRAPHY 22

INTRODUCTION

4
In the realm where technology meets travel logistics, our
exploration of the train booking system begins. Powered by the
versatility of Python programming and a structured MySQL database,
this project seeks to elevate the customer experience by streamlining
ticket bookings, managing snack preferences, and ensuring secure
access with an integrated password management system.
Harnessing the power of Python, we’ve developed a robust system
that allows users to book train tickets, choose from a variety of
snacks, and securely authenticate their accounts with a password
management system. The MySQL database acts as the backbone of the
system, storing and managing all critical data, from user profiles and
booking details to snack choices and transaction history. This enables
efficient and secure access to information while ensuring a smooth
booking experience.
As we embark on this data-driven journey, join us in uncovering the
strategic brilliance behind managing train bookings, optimizing snack
selections, and providing a secure and personalized user experience.
Welcome to a fusion of train travel optimization, user experience
design, and data-driven security, all powered by the analytical
precision of MySQL and Python.

5
OBJECTIVES

The objective of this project is to develop a comprehensive Train


Booking System using MySQL as the database and Python as the
programming language, with a focus on creating a secure, user-
friendly platform for booking train tickets, managing user accounts,
and selecting snacks. The system will allow users to securely register,
log in, and manage their profiles using a password management
system, ensuring data privacy and security. Passengers will be able to
browse available trains, book tickets, and select snacks, providing a
personalized and convenient travel experience.

The entire system’s data, including user profiles, booking details, and
snack preferences, will be stored in a MySQL database, ensuring
efficient management and real-time updates. The project aims to
enhance user experience by providing an intuitive interface, smooth
booking process, and real-time availability tracking for both train
seats and snack options. Ultimately, this system will combine secure,
efficient data handling with a seamless user interface, optimizing the
train booking process and enhancing passenger satisfaction.

6
WORKING

The Train Ticket Booking System allows users to sign up, log in, and
book tickets for 1st and 2nd class journeys, while also providing
snack options. Upon launching, the program connects to a MySQL
database and presents a menu with options for sign-up, login, and
ticket booking. Users who sign up are prompted to enter their details
(name, phone number, tickets, password, etc.), with passwords being
hashed for security before being stored in the database.

After logging in, users can book tickets for either 1st or 2nd class by
entering their booking details and selecting snacks. All booking
information, including the user's name, train, tickets, and snacks, is
saved in the corresponding database tables. The system ensures
secure password management and provides a smooth, interactive
interface for booking tickets and selecting snacks, all while leveraging
MySQL for data storage and retrieval.

FUTURE SCOPE
The project has significant potential for future development and
enhancements. Real-time train tracking can be incorporated, enabling

7
live updates on train schedules and seat availability, improving
accuracy and convenience for passengers. Machine learning models
could be utilized to predict high-demand routes, suggest optimized
schedules, and analyse passenger behaviour for better service
planning. Furthermore, a dedicated mobile application can be
developed to provide on-the-go ticket booking, cancellations, and
notifications. Feedback systems integrated into the application would
allow passengers to share their experiences, enabling continuous
service improvement. These features aim to make the Train Ticket
Booking System more efficient, user-friendly, and technologically
advanced.

8
SOURCE CODE

import pymysql as sqltor


import re

# Function to check if the password is strong


def is_strong_password(t_passwd):
if (len(t_passwd) < 8 or
not re.search(r"[A-Z]", t_passwd) or # At least one
uppercase letter
not re.search(r"[a-z]", t_passwd) or # At least one
lowercase letter
not re.search(r"[0-9]", t_passwd) or # At least one digit
not re.search(r"[!@#$%^&*(),.?\":{}|<>]", t_passwd)): #
At least one special character
return False
return True

# Establish a connection to the MySQL database

9
conn = sqltor.connect(host='localhost', user='root',
passwd='0000', database='ticket_generator')
cl = conn.cursor()

print("Enter your choice as 1,2,3,4")


print("TRAIN TICKET BOOKING")
print("1. SIGN UP")
print("2. LOG IN")
print("3. 1st Class Ticket Booking")
print("4. 2nd Class Ticket Booking")

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

if ch == 1: # SIGN UP
u_gmail = input("Enter your gmail: ")
t_phno = input("Enter phone number: ")
u_lname = input("Enter your last name: ")
t_fname = input("Enter your first name: ")

10
t_passwd = input("Enter your password:(requires strong
password)")
t_userID = input("Enter your userID: ")

# Check if the password is strong


if not is_strong_password(t_passwd):
print("Password is not strong enough. Please ensure it
meets the requirements:")
print("- At least 8 characters long")
print("- At least one uppercase letter")
print("- At least one lowercase letter")
print("- At least one digit")
print("- At least one special character")
else:
# Password is strong, proceed with sign-up

# Insert statement for user sign-up

11
t_ins = "INSERT INTO users (gmail, phone_number,
last_name, first_name, password, ID) VALUES ( %s, %s, %s,
%s, %s, %s)"
cl.execute(t_ins, (u_gmail, t_phno, u_lname, t_fname,
t_passwd, t_userID))

conn.commit()
print("Account created successfully!")
print("Thank you for using our train ticket booking
service.")

# Additional code for login and booking options would go


here...

elif ch == 2: # LOGIN
# Get user input for login
login_userID = input("Enter your userID or phone number:
")
login_passwd = input("Enter your password: ")

12
# Select statement to verify user credentials
login_query = "SELECT * FROM users WHERE (ID = %s OR
phone_number = %s) AND password = %s"

# Execute the query with the provided credentials


cl.execute(login_query, (login_userID, login_userID,
login_passwd))

# Fetch the result


user = cl.fetchone() # Fetch one record

if user:
print("Login successful!")
print(f"Welcome, {user[4]}!") # Assuming user_name is
the 5th column

# Fetch ticket information from first_class table


first_class_query = "SELECT * FROM first_class WHERE
phone_number = %s"
cl.execute(first_class_query, (login_userID,))

13
first_class_tickets = cl.fetchall()

# Fetch ticket information from second_class table


second_class_query = "SELECT * FROM second_class
WHERE phone_number = %s"
cl.execute(second_class_query, (login_userID,))
second_class_tickets = cl.fetchall()

# Display tickets from first class


if first_class_tickets:
print("Your 1st Class Ticket Information:")
for ticket in first_class_tickets:
print(f"Ticket ID: {ticket[0]}, Train Name: {ticket[1]},
Seat Number: {ticket[2]}, Price: {ticket[3]}, Snacks:
{ticket[5]}") # Adjust indices as necessary
else:
print("No 1st Class tickets found.")

# Display tickets from second class

14
if second_class_tickets:
print("Your 2nd Class Ticket Information:")
for ticket in second_class_tickets:
print(f"Ticket ID: {ticket[0]}, Train Name: {ticket[1]},
Seat Number: {ticket[2]}, Price: {ticket[3]}, Snacks:
{ticket[5]}") # Adjust indices as necessary
else:
print("No 2nd Class tickets found.")

else:
print("Login failed! Invalid userID/phone number or
password.")

elif ch == 3: # 1st Class Booking


print("****** Welcome to 1st Class Ticket Booking ******")
t_name = input("Enter your train name: ")
t_user = input("Enter your name: ")
t_tic = input("Enter total tickets: ")
t_phno = input("Enter your phone number: ")

15
t_passwd = input("Enter the password: ")
t_snacks = input("Order your snacks: ")

t_ins = "INSERT INTO first_class


(train_name,user_name,total_tickets, phone_number,
password, snacks)\
VALUES (%s, %s, %s, %s, %s, %s)"
cl.execute(t_ins, (t_name, t_user, t_tic, t_phno, t_passwd,
t_snacks))

conn.commit()
print("** TICKET BOOKED IN 1st CLASS **")

elif ch == 4: # 2nd Class Booking


print("WELCOME TO 2nd CLASS TICKET BOOKING")
t_user = input("Enter your name: ")
t_name = input("Enter your train name: ")
t_phno = input("Enter your phone number: ")
t_tic = input("Enter total tickets: ")

16
t_passwd = input("Enter the password: ")
t_snacks = input("Order your snacks: ")

t_ins = "INSERT INTO second_class (user_name, train_name,


phone_number, \
total_tickets, password, snacks) VALUES (%s, %s, %s, %s, %s,
%s)"
cl.execute(t_ins, (t_user, t_name, t_phno, t_tic, t_passwd,
t_snacks))

conn.commit()
print("ENJOY YOUR JOURNEY AND HAVE FUN!")

else:
print("Invalid choice. Please select a valid option.")

# Close the cursor and connection


cl.close()
conn.close()

17
18
HARDWARE AND SOFTWARE
REQUIREMENTS

Hardware :

I.OPERATING SYSTEM : WINDOWS 7 AND ABOVE

II. PROCESSOR : PENTIUM(ANY) OR AMD

ATHALON(3800+- 4200+ DUAL CORE)

III. MOTHERBOARD : 1.845 OR 915,995 FOR PENTIUM 0R MSI

K9MM-V VIA K8M800+8237R PLUS

CHIPSET FOR AMD ATHLON

IV. RAM : 512MB+

V. Hard disk : SATA 40 GB OR ABOVE

VI. CD/DVD r/w multi drive combo: (If back up required)

VII. FLOPPY DRIVE 1.44 MB : (If Backup required)

VIII. Keyboard and mouse

IX. Printer : (if print is required – [Hard copy])

Software:

19
I. Windows OS
II. Python

BIBLIOGRAPHY
Reference books:

1. Informatics Practices by Sumita Arora

2. Complete reference with Python

3. MySQL

Websites:

https://www.geeksforgeeks.org/python-mysql/

https://www.w3schools.com/python/python_mysql_getstarted.asp

https://www.tutorialaicsip.com

20
DATABASES

First class table

Second class table

Users table

21
22

You might also like