0% found this document useful (0 votes)
6 views4 pages

Train Reservation System Project No Images

The Train Reservation System project, built using Python, allows users to book tickets, check availability, and cancel reservations while demonstrating programming concepts. It utilizes tools like pandas for data management and file handling for storing train and passenger details. The project showcases a practical application of programming skills learned in Classes 11 and 12.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views4 pages

Train Reservation System Project No Images

The Train Reservation System project, built using Python, allows users to book tickets, check availability, and cancel reservations while demonstrating programming concepts. It utilizes tools like pandas for data management and file handling for storing train and passenger details. The project showcases a practical application of programming skills learned in Classes 11 and 12.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Train Reservation System Project

Submitted by: [Your Name]

Class: 12

Subject: Computer Science

Table of Contents
1. Introduction

2. Objectives

3. Tools and Technologies Used

4. Project Code

5. Conclusion
1. Introduction
This project demonstrates a Train Reservation System built using Python. The system allows users

to book tickets, check availability, and cancel reservations. It integrates various programming

concepts learned in Classes 11 and 12, such as file handling, functions, and loops.

2. Objectives
- To create a user-friendly train reservation system.

- To implement real-life scenarios using programming concepts.

- To manage train data, passenger details, and ticket status efficiently.

3. Tools and Technologies Used


1. Python: Programming language for implementation.

2. Libraries: pandas for data management.

3. File Handling: To store and retrieve train and passenger details.

4. Project Code

def add_train():

train_no = input("Enter train number: ")

name = input("Enter train name: ")

source = input("Enter source station: ")

destination = input("Enter destination station: ")

seats = int(input("Enter available seats: "))

with open("trains.txt", "a") as file:

file.write(f"{train_no},{name},{source},{destination},{seats}\n")

def book_ticket():
train_no = input("Enter train number: ")

name = input("Enter passenger name: ")

with open("trains.txt", "r") as file:

lines = file.readlines()

with open("trains.txt", "w") as file:

for line in lines:

details = line.strip().split(",")

if details[0] == train_no:

if int(details[4]) > 0:

details[4] = str(int(details[4]) - 1)

print(f"Ticket booked for {name}!")

else:

print("No seats available!")

file.write(",".join(details) + "\n")

def cancel_ticket():

# Similar logic to book_ticket, but increments seat count.

pass
5. Conclusion
The Train Reservation System project demonstrates how programming concepts can be applied to

solve real-world problems. It provides a basic yet functional approach to train ticket management.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy