ip project 2024-2025
ip project 2024-2025
SUBMITTED BY : P.S.ABHIJAY
ROLL NO : ______________
NAME :
CLASS : XII( PCM)
SUBJECT : INFORMATICS PRACTICES
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.
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.
Lastly, we would like to gratify all those who had directly or indirectly
helped with this project.
P.S.ABHIJAY
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
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 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
9
conn = sqltor.connect(host='localhost', user='root',
passwd='0000', database='ticket_generator')
cl = conn.cursor()
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: ")
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.")
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"
if user:
print("Login successful!")
print(f"Welcome, {user[4]}!") # Assuming user_name is
the 5th column
13
first_class_tickets = cl.fetchall()
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.")
15
t_passwd = input("Enter the password: ")
t_snacks = input("Order your snacks: ")
conn.commit()
print("** TICKET BOOKED IN 1st CLASS **")
16
t_passwd = input("Enter the password: ")
t_snacks = input("Order your snacks: ")
conn.commit()
print("ENJOY YOUR JOURNEY AND HAVE FUN!")
else:
print("Invalid choice. Please select a valid option.")
17
18
HARDWARE AND SOFTWARE
REQUIREMENTS
Hardware :
Software:
19
I. Windows OS
II. Python
BIBLIOGRAPHY
Reference books:
3. MySQL
Websites:
https://www.geeksforgeeks.org/python-mysql/
https://www.w3schools.com/python/python_mysql_getstarted.asp
https://www.tutorialaicsip.com
20
DATABASES
Users table
21
22