Ip Project
Ip Project
__________________________
I would like to express my heartfelt gratitude to my teacher,
Mrs. Rakhi Parmar for their invaluable guidance, support, and
encouragement throughout the development of the Railway
Reservation System project. Their expert advice and constant
motivation were instrumental in completing this project
successfully.
I also appreciate the resources and knowledge provided by
various open-source communities, which helped me tackle
challenges during the project.
Thank you once again for your unwavering support and
mentorship.
About Python
__________________________
In the vast landscape of programming languages, Python stands as a
beacon of versatility, simplicity, and power. Developed by Guido van
Rossum in the late 1980s, Python has evolved into one of the most
popular and widely-used programming languages worldwide. Its appeal
lies in its readability, ease of use, and comprehensive standard libraries,
making it a top choice for beginners and seasoned developers alike.
At its core, Python embodies a philosophy of code readability and
simplicity. Its clean and easily understandable syntax allows developers
to express concepts in fewer lines of code compared to other
languages. It finds applications across diverse fields, from web
development and data analysis to artificial intelligence and scientific
computing. The language's extensive libraries, including but not limited
to Pandas, NumPy, Matplotlib, and TensorFlow, empower developers to
tackle various challenges efficiently. For instance, Pandas, a powerful
data manipulation library, simplifies the process of data analysis and
manipulation, allowing users to work with structured data seamlessly.
In conclusion, Python's simplicity, versatility, extensive libraries, and
community support position it as a cornerstone of modern
programming. Its impact spans from novice programmers to industry
experts, making it a driving force in technological advancements across
numerous fields.
About My SQL
__________________________
MySQL is an open-source relational database management system
(RDBMS) that has become a cornerstone in the world of databases. It
was developed by Michael Widenius, MySQL was initially released in
1995.
MySQL is open-source, allowing users to modify and redistribute the
software, contributing to its wide adoption and continuous
development. MySQL runs on various operating systems, making it a
versatile choice for diverse environments.
It empowers numerous web-based applications and content
management systems due to its speed, reliability, and compatibility
with popular web development stacks. It is widely used in enterprises
for managing critical business data, customer information, and
analytics.it is embedded due to its lightweight nature, it's utilized in
embedded applications, IoT devices, and other resource-constrained
environments.
Despite the emergence of newer databases, MySQL remains a popular
choice due to its stability, performance, and wide adoption. MySQL
continues to be a leading relational database, catering to diverse needs
across industries and application domains, fostering innovation, and
supporting the growth of robust and scalable data solutions.
Introduction of the Project
__________________________
Railways serve as one of the most vital modes of transportation,
connecting cities and regions across vast distances efficiently and
economically. With the increasing reliance on technology in daily life,
the need for a digital solution to streamline railway ticket bookings has
become more critical than ever. This project focuses on the
development of a Railway Reservation System, designed to simplify and
automate the process of booking, managing, and canceling railway
tickets.
The primary objective of this system is to enhance user experience by
reducing manual processes and eliminating the complexities associated
with traditional booking systems. The Railway Reservation System will
provide features like seat availability checks, passenger details
management, and real-time ticket reservation functionalities. By
leveraging technology, this system aims to minimize errors, save time,
and improve accessibility for users.
This project serves as a practical application of programming concepts,
database management, and system design, offering insights into real-
world problem-solving while addressing a significant need in the
transportation sector. Through this initiative, the project showcases the
potential of digital solutions to transform traditional systems into more
efficient and user-friendly alternatives.
Software and Hardware
Requirements
__________________________
Software Specifications:-
▪ Operating system: Windows 10/8/7
▪ Platform
➢ Python IDLE 3.7
▪ Database
➢ MySQL
▪ Languages
➢ Python
Hardware Specifications:-
▪ Processor: Dual core or above
▪ Hard Disk: 40 GB
▪ RAM
➢ 1024 MB
Module
__________________________
class RailwayReservation:
def __init__(self):
self.available_seats = 50 # Available seats in the train
self.booked_seats = 0 # Initially no seats are booked
self.passenger_details = {} # Dictionary to store passenger details
# Simulated train schedule with routes and their departure/arrival times (Real
Train Names)
self.train_routes = {
'Mumbai': {
'Delhi': {
'Rajdhani Express': {
'departure': '16:30', 'arrival': '08:00', 'seats': 50, 'base_price': 2500,
'train_type': 'Express',
'coaches': {
'AC': {'seats': 20, 'position': '1-10', 'seating': []},
'Sleeper': {'seats': 30, 'position': '11-20', 'seating': []}
}
},
'Shatabdi Express': {
'departure': '06:00', 'arrival': '14:00', 'seats': 50, 'base_price': 1500,
'train_type': 'Superfast',
'coaches': {
'AC': {'seats': 30, 'position': '1-15', 'seating': []},
'Sleeper': {'seats': 20, 'position': '16-20', 'seating': []}
}
}
},
'Bangalore': {
'Karnataka Express': {
'departure': '22:30', 'arrival': '18:30', 'seats': 50, 'base_price': 2000,
'train_type': 'Express',
'coaches': {
'AC': {'seats': 20, 'position': '1-10', 'seating': []},
'Sleeper': {'seats': 30, 'position': '11-20', 'seating': []}
}
},
'Mumbai-Bangalore Superfast': {
'departure': '11:30', 'arrival': '07:00', 'seats': 50, 'base_price': 1800,
'train_type': 'Superfast',
'coaches': {
'AC': {'seats': 20, 'position': '1-10', 'seating': []},
'Sleeper': {'seats': 30, 'position': '11-20', 'seating': []}
}
}
},
'Hyderabad': {
'Godavari Express': {
'departure': '19:15', 'arrival': '11:00', 'seats': 50, 'base_price': 2200,
'train_type': 'Express',
'coaches': {
'AC': {'seats': 20, 'position': '1-10', 'seating': []},
'Sleeper': {'seats': 30, 'position': '11-20', 'seating': []}
}
},
'Telangana Express': {
'departure': '09:00', 'arrival': '22:30', 'seats': 50, 'base_price': 2000,
'train_type': 'Superfast',
'coaches': {
'AC': {'seats': 20, 'position': '1-10', 'seating': []},
'Sleeper': {'seats': 30, 'position': '11-20', 'seating': []}
}
}
}
},
'Delhi': {
'Kolkata': {
'Howrah Rajdhani': {
'departure': '17:00', 'arrival': '08:00', 'seats': 50, 'base_price': 2700,
'train_type': 'Express',
'coaches': {
'AC': {'seats': 20, 'position': '1-10', 'seating': []},
'Sleeper': {'seats': 30, 'position': '11-20', 'seating': []}
}
},
'Shatabdi Express': {
'departure': '08:00', 'arrival': '18:00', 'seats': 50, 'base_price': 1800,
'train_type': 'Superfast',
'coaches': {
'AC': {'seats': 20, 'position': '1-10', 'seating': []},
'Sleeper': {'seats': 30, 'position': '11-20', 'seating': []}
}
}
},
'Pune': {
'Deccan Queen': {
'departure': '12:30', 'arrival': '23:30', 'seats': 50, 'base_price': 2100,
'train_type': 'Express',
'coaches': {
'AC': {'seats': 20, 'position': '1-10', 'seating': []},
'Sleeper': {'seats': 30, 'position': '11-20', 'seating': []}
}
},
'Gitanjali Express': {
'departure': '10:30', 'arrival': '20:00', 'seats': 50, 'base_price': 2000,
'train_type': 'Superfast',
'coaches': {
'AC': {'seats': 20, 'position': '1-10', 'seating': []},
'Sleeper': {'seats': 30, 'position': '11-20', 'seating': []}
}
}
},
'Mumbai': { # Delhi to Mumbai Route added here
'Rajdhani Express': {
'departure': '15:30', 'arrival': '06:00', 'seats': 50, 'base_price': 2400,
'train_type': 'Express',
'coaches': {
'AC': {'seats': 20, 'position': '1-10', 'seating': []},
'Sleeper': {'seats': 30, 'position': '11-20', 'seating': []}
}
},
'Shatabdi Express': {
'departure': '05:30', 'arrival': '14:00', 'seats': 50, 'base_price': 1500,
'train_type': 'Superfast',
'coaches': {
'AC': {'seats': 30, 'position': '1-15', 'seating': []},
'Sleeper': {'seats': 20, 'position': '16-20', 'seating': []}
}
},
'August Kranti Rajdhani': {
'departure': '23:00', 'arrival': '10:30', 'seats': 50, 'base_price': 2200,
'train_type': 'Express',
'coaches': {
'AC': {'seats': 20, 'position': '1-10', 'seating': []},
'Sleeper': {'seats': 30, 'position': '11-20', 'seating': []}
}
}
}
},
'Chennai': {
'Bangalore': {
'Karnataka Express': {
'departure': '20:45', 'arrival': '06:00', 'seats': 50, 'base_price': 1900,
'train_type': 'Express',
'coaches': {
'AC': {'seats': 20, 'position': '1-10', 'seating': []},
'Sleeper': {'seats': 30, 'position': '11-20', 'seating': []}
}
}
},
'Hyderabad': {
'Huzurabad Express': {
'departure': '14:30', 'arrival': '06:30', 'seats': 50, 'base_price': 2100,
'train_type': 'Express',
'coaches': {
'AC': {'seats': 20, 'position': '1-10', 'seating': []},
'Sleeper': {'seats': 30, 'position': '11-20', 'seating': []}
}
}
}
}
}
print("\nAvailable Trains:")
try:
available_trains = self.train_routes[boarding_station][destination]
for train in available_trains:
print(f"- {train}")
except KeyError:
print("No route found.")
# Calculate GST
gst_amount = self.calculate_gst(final_price)
self.booked_seats += 1
self.available_seats -= 1
print(f"Ticket booked successfully for {name} on {train_name}!")
if name_to_cancel in self.passenger_details:
train_name = self.passenger_details[name_to_cancel]['Train Name']
boarding_station = self.passenger_details[name_to_cancel]['Boarding
Station']
destination = self.passenger_details[name_to_cancel]['Destination']
coach_name = self.passenger_details[name_to_cancel]['Coach Name']
del self.passenger_details[name_to_cancel]
self.booked_seats -= 1
self.available_seats += 1
print(f"Ticket for {name_to_cancel} cancelled successfully!")
else:
print("No booking found for the given name.")
else:
print("No bookings to cancel.")
while True:
print("\nRailway Reservation System")
print("1. Book Ticket")
print("2. Cancel Ticket")
print("3. Show All Bookings")
print("4. Exit")
print("Enter your choice: ", end="")
choice = input()
try:
choice = int(choice)
except ValueError:
print("Invalid input! Please enter a number.")
continue
if choice == 1:
system.book_ticket()
elif choice == 2:
system.cancel_ticket()
elif choice == 3:
system.show_bookings()
elif choice == 4:
print("Exiting system...")
break
else:
print("Invalid choice! Please try again.")
if __name__ == "__main__":
main()
Sample Output
__________________________
Railway Reservation System
1. Book Ticket
2. Cancel Ticket
3. Show All Bookings
4. Exit
Enter your choice: 1
Enter your details to book a ticket:
Enter Name: Adarsh Tripathi
Enter Age: 16
Enter Boarding Station: Mumbai
Enter Destination: Delhi
Enter Ticket Type (AC / Sleeper): Sleeper
Available Trains:
- Rajdhani Express
- Shatabdi Express
Enter Train Name: Rajdhani Express
Ticket booked successfully for Adarsh Tripathi on Rajdhani Express!
********** TICKET **********
Passenger Name: Adarsh Tripathi
Age: 16
Boarding Station: Mumbai
Destination: Delhi
Train: Rajdhani Express
Departure Time: 16:30
Arrival Time: 08:00
Coach: Sleeper (Position: 11-20)
Seat Number: 12
***************************
Seats Left in Sleeper Coach: 29
Available Trains:
- Deccan Queen
- Gitanjali Express
Enter Train Name: Gitanjali Express
Ticket booked successfully for Satyam Singh on Gitanjali Express!
***************************
Seats Left in AC Coach: 19
Available Trains:
- Howrah Rajdhani
- Shatabdi Express
Enter Train Name: Howrah Rajdhani
Ticket booked successfully for Sandhesh Vishwakarma on Howrah Rajdhani!
***************************
Seats Left in AC Coach: 19
Available Trains:
- Deccan Queen
- Gitanjali Express
Enter Train Name: Deccan Queen
Ticket booked successfully for Naina Vishwakarma on Deccan Queen!
***************************
Seats Left in AC Coach: 19
Current Bookings:
Name: Satyam Singh, Age: 17, Ticket Type: ac, Train: Gitanjali Express, Boarding
Station: Delhi, Destination: Pune, Departure: 10:30, Arrival: 20:00, Coach: AC, Seat
No: 15, Price: ₹3000.0, GST: ₹540.0, Total Bill: ₹3540.0
Name: Aniket Prasad, Age: 17, Ticket Type: ac, Train: Karnataka Express, Boarding
Station: Chennai, Destination: Bangalore, Departure: 20:45, Arrival: 06:00, Coach:
AC, Seat No: 2, Price: ₹2850.0, GST: ₹513.0, Total Bill: ₹3363.0
Name: Sandhesh Vishwakarma, Age: 17, Ticket Type: ac, Train: Howrah Rajdhani,
Boarding Station: Delhi, Destination: Kolkata, Departure: 17:00, Arrival: 08:00,
Coach: AC, Seat No: 10, Price: ₹4050.0, GST: ₹729.0, Total Bill: ₹4779.0
Name: Naina Vishwakarma, Age: 17, Ticket Type: ac, Train: Deccan Queen,
Boarding Station: Delhi, Destination: Pune, Departure: 12:30, Arrival: 23:30,
Coach: AC, Seat No: 6, Price: ₹3150.0, GST: ₹567.0, Total Bill: ₹3717.0