0% found this document useful (0 votes)
18 views

IP Practical File

Uploaded by

priyanshu3449
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)
18 views

IP Practical File

Uploaded by

priyanshu3449
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/ 39

SANSKRITI………THE

SCHOOL,AJMER
Affiliated to CBSE (1730295)
Ajmer (Raj.) Pin:305023

Informatics Practices
A project on - Railway Reservation System

Class XII Informatics Practices (CBSE)


Submitted By: Priyanshu Priyani
Roll No:
IN PARTIAL FULFILLMENT OF THE REQUIREMENT OF THE
ALL INDIA SENIOR SCHOOL EXAMINATION (AISSE)
Batch: 2024-25
Sanskriti………The School,Ajmer

Department of Commerce

CERTIFICATE

This is to certify that Priyanshu Priyani, Student of class XII


Informatics Practices has successfully completed the research on
the below mentioned project under the guidance of Ms. Devi
Dhanani, during the year 2024-25 in partial fulfilment of Social
Science Practical Examination conducted by AISSE, New Delhi.

Signature Signature
(Principal) (Ms.Devi Dhanani)

Signature
(External)
ACKNOWLEDGMENT

I express my deep gratitude and appreciation to those who


agreed to participate in this project for their time expended
and courage in sharing their insights with a fledgling
student. It is to them that I am most indebted, and I can only
hope that the product of our collaboration benefits each one
as much as I benefited from the process.
I had been immeasurably enriched by working under the
supervision of Ms. Devi Dhanani, the subject teacher, who
has great level of knowledge and who has the art of
encouraging, correcting and directing me in every situation
possible, which has enabled me to complete this project.
Also, I thank Ms. Manisha Johri Principal,
Sanskriti………The School, Ajmer for supporting me in
completing this project.
At times, my studies carried out at great cost to those closest
to me. I thank my family and my fellow students for their
best understanding and support.
I acknowledge to all the people who have involved and
supported me in making this project.

Submitted By: Priyanshu Priyani


Roll No:
TABLE OF CONTENT

• AIM
• INTRODUCTION
• THEORETICAL BACKGROUND
• HARDWARE AND SOFTWARE
• LIST OF REPORTS
• CSV FILE
• CODING AND OUTPUT OF PROJECT
• ADVANTAGES
• DISADVANTAGES
• CONCLUSION
• BIBLIOGRAPHY
AIM
The main objective of the Railway
Reservation System is to manage the details
of Train, Booking ,Payment , Seat, Ticket.
It manages all the information about Train,
Customer, Ticket, Train.
The project is totally built at the
administrative end and thus only the
administrator is guaranteed the access.
The purpose of the project is to build an
application program to reduce the manual
work for managing the Train, Booking,
Customer, Payment. It tracks all the details
about the Payment, Seat, Ticket.
INTRODUCTION
This project is a system for storing and
managing railway reservation data. It keeps
information about trains, such as their
names, schedules, routes, and the areas they
serve. The system also records ticket prices,
passenger bookings, and train inquiries. It
includes tools to create graphs and reports,
making it easier to understand data like
ticket sales, train usage, and performance in
different areas. Users can check train
schedules, ticket availability, and other
details. This system helps make railway
operations easier to manage and improves
the experience for passengers and staff.
THEORETICAL
BACKGROUND

What is Python?
Python is a simple and powerful programming language. It is
easy to read and write, making it great for beginners and
experienced developers. Python is used for many purposes,
like building applications, automating tasks, or connecting
different software systems.
It has built-in tools for working with data and supports
features like modules and packages, which make it easier to
organize and reuse code. Python works on all major platforms
and is free to download and use.
Developers like Python because it increases productivity. If
there’s an error in the program, Python shows a clear message
instead of crashing. It also has a built-in debugger to help find
and fix problems. Debugging can also be done quickly by
using simple print statements to check the program’s behavior.
What is Pandas?
Pandas is a Python library used for working with data. It is
named after "Panel Data System" and is popular for analyzing
and managing large amounts of data. Pandas makes it easy to
organize, clean, and analyze data to find useful insights.
To use Pandas, you need to import it along with NumPy by
writing:
python
Copy code
import pandas as pd

import numpy as np

Pandas works well with big tables of data in different formats.


It provides two main tools to store data:
● Series: A one-dimensional list of data.
● DataFrame: A two-dimensional table, like a
spreadsheet.
What is Data Visualization?
Data visualization means showing data in pictures, like graphs
and charts, to make it easier to understand. It helps explain
patterns, relationships, and trends in data, especially when the
data is large and complex.
Why is Data Visualization Important?
● Helps analyze data better.
● Makes it easier to make quick decisions.
● Shows patterns and trends clearly.
● Helps find mistakes in data.
● Tells the story behind the data.
● Provides business insights for planning.
● Tracks changeS over time.
What is matplotlib.pyplot?
Matplotlib is a Python library for creating 2D graphs like line
plots, bar charts, and histograms.
pyplot is a module in Matplotlib that simplifies plotting by
automatically creating figures and axes when needed. It's
commonly used with NumPy for quick, non-interactive
visualizations.
Example: python
import matplotlib.pyplot as plt

x = [1, 2, 3, 4]

y = [10, 20, 25, 30]

plt.plot(x, y)

plt.title("Line Plot")

plt.show()

TYPES OF CHARTS
HARDWARE AND SOFTWARE REQUIREMENTS

HARDWARE SYSTEM:

● Operating System: Windows 10 Pro, 64-Bit


● Language: English
● System Manufacturer: Dell/HP/Other leading brands
● BIOS: Latest version compatible with the system
● Processor: Intel Core i5 or higher (Quad-Core, 2.6 GHz or
above)
● Memory (RAM): 8 GB or higher
● DirectX Version: DirectX 12 or higher

DISPLAY DEVICE:

● Graphics Card: Intel UHD Graphics 630 or better (or


equivalent NVIDIA/AMD GPU)
● Monitor: Full HD (1920x1080) resolution, 60 Hz or higher

DRIVERS:

● Latest drivers for the installed graphics card and hardware


components, supporting WDDM 2.0 or higher

SOFTWARE REQUIREMENT:

● Operating System: Windows 10 or Windows 11 (64-bit


recommended)
● Python: Python 3.10 or higher installed
● IDE: PyCharm, VS Code, or Python IDLE
● Database: MySQL 8.0 or higher installed and configured
● Libraries: Pandas, Matplotlib, and NumPy pre-installed via
pip or conda
CSV File

Train

Passenger

Schedule
CODING
import pandas as pd

import matplotlib.pyplot as plt

def menu():

print()

print("**************************************************************")

print("************************ RAILWAYS RESERVATION SYSTEM PROJECT


************************")

print("**************************************************************")

print()

print("0. Know about the project")

print("1. Reading file train")

print("2. Adding new train details in file")

print("3. Schedule of all trains")

print("4. Total number of trains")

print("5. Sorting train by number of train")

print("6. Train Fare")

print("7. Train Enquiry")

print("8. Cancel Train")

print("9. Delay in Arrival")

print("10. Read Passengers File")

print("11. Adding New Passenger's Detail in File")

print("12. Ticket Reservation")


print("13. Show status of the Ticket")

print("14. Top and Bottom Records from passenger")

print("15. Line plot")

print("16. Line Plot")

print("17. Bar Plot")

print("18. Bar Plot 2")

print("19. Horizontal Bar Plot")

print("20. Horizontal Bar Plot 2")

print("**************************************************************")

print()

menu()

def about():

print("The project is developed on RAILWAY RESERVATION SYSTEM. It contains 20


options.\nIn the project, 3 CSV Files are used: Train, Passengers, and Schedule.")

def read_train():

print('Reading details of file Train')

df = pd.read_csv("train.csv", index_col=0)

print(df)

def new_train():

print("Adding new train in file train")

df = pd.read_csv("train.csv", index_col=0)
print(df)

a = int(input("Enter train number:"))

b = input("Enter train name:")

c = input("Enter source:")

d = input("Enter destination:")

e = input("Enter AC fare:")

f = input("Enter sleeper fare:")

df.loc[a] = [b, c, d, e, f]

print(df)

def schedule():

print("Schedule of ALL Trains")

df = pd.read_csv("schedule.csv", index_col=0)

print(df)

def total_trains():

print('Find Total Trains')

df = pd.read_csv("train.csv")

print(df)

def sort_trainno():

print('Sorting Train No. of Trains in Descending order')

df = pd.read_csv("train.csv", index_col=0)

df = df.sort_values('tnum', ascending=False)

print(df)
def fare():

print('Sorting Trains Names in Ascending order and show Fares')

df = pd.read_csv("train.csv", index_col=0, usecols=['tname', 'Ac', 'slp'])

df = df.sort_values('tname')

print(df)

def enquiry():

print('Find out Arrival Time of a Train')

df = pd.read_csv("schedule.csv", index_col=0)

print(df)

# print(df.loc[df['tnum'] == 5353])

def cancel_train():

print("Cancel Train")

df = pd.read_csv("schedule.csv", index_col=0)

print(df)

tnum = int(input("Enter the train number to delete: "))

df.drop(tnum, axis=0, inplace=True)

print("Record of train temporarily deleted")

print(df)

def change_timing():

df = pd.read_csv("schedule.csv")

print("Previous timings of arrival")


print(df)

df.loc[df['tnum'] == 5353, ['arrival']] = df['arrival'] + ':40'

print(df)

def read_passengers():

print("Reading file passenger")

df = pd.read_csv("passenger.csv")

print(df)

def new_passenger():

print("Adding new passenger in file passenger")

df = pd.read_csv("passenger.csv", index_col=0)

print(df)

n = input("Enter the passenger name: ")

a = int(input("Enter the age: "))

tn = int(input("Enter train no.:"))

noofp = int(input("Enter the number of passengers: "))

c = input("Enter the class: ")

d = input("Enter the destination: ")

amt = int(input("Enter the amount: "))

s = input("Enter the status: ")

pnr = input("Enter the PNR no.: ")

df.loc[n] = [a, tn, noofp, c, d, amt, s, pnr]

print(df)
def ticket_reservation():

print("WE HAVE THE FOLLOWING SEAT TYPES FOR YOU:")

print("TNUMBER 1: GOA EXPRESS FROM NEW DELHI")

print("1. FIRST CLASS AC - RS 6000 PER PERSON")

print("2. SLEEPER - RS 3000 PER PERSON")

print("TNUMBER 2: JAMMU EXPRESS FROM NEW DELHI")

print("1. FIRST CLASS AC - RS 10000 PER PERSON")

print("2. SLEEPER - RS 7000 PER PERSON")

tname = input("Enter your choice of train name: ")

print(tname)

x = int(input("Enter your choice of ticket: "))

n = int(input("How many tickets do you need? "))

if x == 1:

print("You have chosen first class AC ticket.")

s = 6000 * n

elif x == 2:

print("You have chosen sleeper ticket.")

s = 3000 * n

else:

print("Invalid option")

print("Please choose a train.")

return

print(f"Your total ticket price is = {s}.\n")


def status():

print("Show the status of ticket")

df = pd.read_csv("passenger.csv", usecols=['pname', 'status'])

print(df)

def top_bottom():

df = pd.read_csv("passenger.csv")

print('Top 2 rows')

print(df.head(2))

print("Last 2 rows")

print(df.tail(2))

def line_plot():

print("Line plot")

df = pd.read_csv("train.csv")

x = df['tname']

y = df['Ac']

plt.title('AC fare for train', fontsize=14, color="r")

plt.xlabel("Trains", fontsize=14, color="r")

plt.ylabel("AC fare", fontsize=14, color="r")

plt.plot(x, y, marker="x", ls="dashed", linewidth=4, color="g")

plt.show()

def line1_plot():
df = pd.read_csv("train.csv")

plt.plot(df['tname'], df['slp'], marker='o', label="Fare")

plt.title("Sleeper fare for trains", fontsize=14, color="r")

plt.xlabel("Trains", fontsize=14, color="r")

plt.ylabel("Sleeper fare", fontsize=14, color="r")

plt.xticks(rotation=30)

plt.legend()

plt.grid(True)

plt.show()

def bar_plot():

print("Bar plot")

df = pd.read_csv("train.csv")

x = df["tname"]

y = df["slp"]

plt.title("Sleeper fare for trains", fontsize=14, color="r")

plt.xlabel("Trains", fontsize=14, color="r")

plt.ylabel("Sleeper fare", fontsize=14, color="r")

plt.xticks(rotation=30)

plt.bar(x, y, color=['red', 'yellow'])

plt.show()

def bar1_plot():

print('Bar plot')

df = pd.read_csv("train.csv")
x = df['tname']

y = df['Ac']

plt.title('Sleeper fare for trains', fontsize=14, color="g")

plt.xlabel("Trains", fontsize=14, color="g")

plt.ylabel("AC fare", fontsize=14, color="g")

plt.xticks(rotation=30)

plt.bar(x, y, color=["orange", "blue"])

plt.show()

def barh_plot():

print('Horizontal bar plot')

df = pd.read_csv("train.csv")

x = df['tname']

y = df['slp']

plt.title('Sleeper fare for trains', fontsize=14, color="b")

plt.xlabel('Trains', fontsize=14, color='b')

plt.ylabel('Sleeper fare', fontsize=14, color="b")

plt.barh(x, y, color='blue', edgecolor="pink")

plt.show()

def barh1_plot():

print("Horizontal bar plot")

df = pd.read_csv("train.csv")

x = df["tname"]

y = df["slp"]
plt.title("Sleeper fare for trains", fontsize=14, color="r")

plt.xlabel('Train', fontsize=14, color="r")

plt.ylabel("AC fare", fontsize=14, color="r")

plt.barh(x, y, color="orange", edgecolor="red")

plt.show()

# Main Menu Options

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

if opt == 0:

about()

elif opt == 1:

read_train()

elif opt == 2:

new_train()

elif opt == 3:

schedule()

elif opt == 4:

total_trains()

elif opt == 5:

sort_trainno()

elif opt == 6:

fare()

elif opt == 7:

enquiry()
elif opt == 8:

cancel_train()

elif opt == 9:

change_timing()

elif opt == 10:

read_passengers()

elif opt == 11:

new_passenger()

elif opt == 12:

ticket_reservation()

elif opt == 13:

status()

elif opt == 14:

top_bottom()

elif opt == 15:

line_plot()

elif opt == 16:

line1_plot()

elif opt == 17:

bar_plot()

elif opt == 18:

bar1_plot()

elif opt == 19:

barh_plot()

elif opt == 20:


barh1_plot()

else:

print("Invalid option")

print("\a")
Outputs
OUTPUT
Enter your choice: 1

Reading details of file Train

tname source destinatic Ac slp

tnum

4347 go express delhi goa 6000 3000

5353 jammu tawi delhi jammu 10000 7000

4356 punjab express delhi punjab 8000 6000

2345 haryana express delhi haryana 7000 4000

5678 mumbai express delhi mumbai 8900 3400

3490 chennai express delhi chennai 10000 8900

1209 bihar express delhi bihar 20000 10000

Enter your choice: 2

Adding new train in file train

tname source destinatic Ac slp

tnum

4347 go express delhi goa 6000 3000

5353 jammu tawi delhi jammu 10000 7000

4356 punjab express delhi punjab 8000 6000

2345 haryana express delhi haryana 7000 4000

5678 mumbai express delhi mumbai 8900 3400

3490 chennai express delhi chennai 10000 8900


1209 bihar express delhi bihar 20000 10000

Enter train number: 3456

Enter train name: kerala express

Enter source: delhi

Enter destination: kerala

Enter AC fare: 4500

Enter sleeper fare: 5000

tname source destinatic Ac slp

tnum

4347 go express delhi goa 6000 3000

5353 jammu tawi delhi jammu 10000 7000

4356 punjab express delhi punjab 8000 6000

2345 haryana express delhi haryana 7000 4000

5678 mumbai express delhi mumbai 8900 3400

3490 chennai express delhi chennai 10000 8900

1209 bihar express delhi bihar 20000 10000

3456 kerala express delhi kerala 4500 5000

Enter your choice: 3

Schedule of ALL Trains

tname departure arrival source destination

tnum

5353 jammu tawi 10:32 21:03 delhi jammu

4356 punjab express 06:35 12:00 delhi punjab


4347 goa express 06:51 18:05 delhi goa

3490 haryana express 03:45 12:09 delhi haryana

4560 mumbai express 05:09 15:45 delhi mumbai

5670 kerala express 08:25 16:45 delhi kerala

Enter your choice: 4

Find Total Trains

tnum tname source destinatic Ac slp

0 4347 go express delhi goa 6000 3000

1 5353 jammu tawi delhi jammu 10000 7000

2 4356 punjab express delhi punjab 8000 6000

3 2345 haryana express delhi haryana 7000 4000

4 5678 mumbai express delhi mumbai 8900 3400

5 3490 chennai express delhi chennai 10000 8900

6 1209 bihar express delhi bihar 20000 10000

Enter your choice: 5

Sorting Train No. of Trains in Descending order

tname source destinatic Ac slp

tnum

5678 mumbai express delhi mumbai 8900 3400

5353 jammu tawi delhi jammu 10000 7000

4356 punjab express delhi punjab 8000 6000

4347 go express delhi goa 6000 3000

3490 chennai express delhi chennai 10000 8900

2345 haryana express delhi haryana 7000 4000

1209 bihar express delhi bihar 20000 10000


Enter your choice: 6

Sorting Trains Names in Ascending order and show Fares

Ac slp

tname

bihar express 20000 10000

chennai express 10000 8900

go express 6000 3000

haryana express 7000 4000

jammu tawi 10000 7000

mumbai express 8900 3400

punjab express 8000 6000

Enter your choice: 7

Find out Arrival Time of a Train

tname departure arrival source destination

tnum

5353 jammu tawi 10:32 21:03 delhi jammu

4356 punjab express 06:35 12:00 delhi punjab

4347 goa express 06:51 18:05 delhi goa

3490 haryana express 03:45 12:09 delhi haryana

4560 mumbai express 05:09 15:45 delhi mumbai

5670 kerala express 08:25 16:45 delhi kerala


Enter your choice: 8
Cancel Train
tname departure arrival source destination
tnum
5353 jammu tawi 10:32 21:03 delhi jammu
4356 punjab express 06:35 12:00 delhi punjab
4347 goa express 06:51 18:05 delhi goa
3490 haryana express 03:45 12:09 delhi haryana
4560 mumbai express 05:09 15:45 delhi mumbai
5670 kerala express 08:25 16:45 delhi kerala

Enter the train number to delete: 5353

Record of train temporarily deleted


tname departure arrival source destination
tnum
4356 punjab express 06:35 12:00 delhi punjab
4347 goa express 06:51 18:05 delhi goa
3490 haryana express 03:45 12:09 delhi haryana
4560 mumbai express 05:09 15:45 delhi mumbai
5670 kerala express 08:25 16:45 delhi kerala

Enter your choice: 9


Previous timings of arrival
tnum tname departure arrival source destination
0 5353 jammu tawi 10:32 21:03 delhi jammu
1 4356 punjab express 06:35 12:00 delhi punjab
2 4347 goa express 06:51 18:05 delhi goa
3 3490 haryana express 03:45 12:09 delhi haryana
4 4560 mumbai express 05:09 15:45 delhi mumbai
5 5670 kerala express 08:25 16:45 delhi kerala
tnum tname departure arrival source destination
0 5353 jammu tawi 10:32 21:03:40 delhi jammu
1 4356 punjab express 06:35 12:00 delhi punjab
2 4347 goa express 06:51 18:05 delhi goa
3 3490 haryana express 03:45 12:09 delhi haryana
4 4560 mumbai express 05:09 15:45 delhi mumbai
5 5670 kerala express 08:25 16:45 delhi kerala

Enter your choice: 10

Reading file passenger


pname age train no no of pas cls destinatic amt status \
0 Ankit Kumar 47 4347 1 Ac1 goa 6000 conf
1 Mahinder 54 5353 2 sleeper jammu 10000 conf
2 Meena Rai 38 4347 2 Ac1 goa 6000 conf
3 Rohan Gupta 18 5668 1 Ac1 haryana 5000 conf
4 Yashika Kaul 17 3456 2 sleeper chennai 4500 conf
5 Nikhil Saini 26 2356 6 Ac1 Nepal 2000 conf
6 Mehul Saini 23 8907 2 sleeper goa 4000 conf
7 DOLI 34 2890 1 sleeper rajasthan 7899 conf

pnrno
0 G1001
1 G1002
2 G1003
3 G1004
4 G1005
5 G1006
6 G1007
7 G1008

Enter your choice: 11

Adding new passenger in file passenger


age train no no of pas cls destinatic amt status \
pname
Ankit Kumar 47 4347 1 Ac1 goa 6000 conf
Mahinder 54 5353 2 sleeper jammu 10000 conf
Meena Rai 38 4347 2 Ac1 goa 6000 conf
Rohan Gupta 18 5668 1 Ac1 haryana 5000 conf
Yashika Kaul 17 3456 2 sleeper chennai 4500 conf
Nikhil Saini 26 2356 6 Ac1 Nepal 2000 conf
Mehul Saini 23 8907 2 sleeper goa 4000 conf
DOLI 34 2890 1 sleeper rajasthan 7899 conf

pnrno
pname
Ankit Kumar G1001
Mahinder G1002
Meena Rai G1003
Rohan Gupta G1004
Yashika Kaul G1005
Nikhil Saini G1006
Mehul Saini G1007
DOLI G1008

Enter the passenger name: karan


Enter the age: 23
Enter train no.: 34567
Enter the number of passengers: 6
Enter the class: ac1
Enter the destination: mumbai
Enter the amount: 3000
Enter the status: conf
Enter the PNR no.: gl02

age train no no of pas cls destinatic amt status \


pname
Ankit Kumar 47 4347 1 Ac1 goa 6000 conf
Mahinder 54 5353 2 sleeper jammu 10000 conf
Meena Rai 38 4347 2 Ac1 goa 6000 conf
Rohan Gupta 18 5668 1 Ac1 haryana 5000 conf
Yashika Kaul 17 3456 2 sleeper chennai 4500 conf
Nikhil Saini 26 2356 6 Ac1 Nepal 2000 conf
Mehul Saini 23 8907 2 sleeper goa 4000 conf
DOLI 34 2890 1 sleeper rajasthan 7899 conf
karan 23 34567 6 ac1 mumbai 3000 conf

pnrno
pname
Ankit Kumar G1001
Mahinder G1002
Meena Rai G1003
Rohan Gupta G1004
Yashika Kaul G1005
Nikhil Saini G1006
Mehul Saini G1007
DOLI G1008
karan gl02

Enter your choice: 12

WE HAVE THE FOLLOWING SEAT TYPES FOR YOU:


TNUMBER 1: GOA EXPRESS FROM NEW DELHI
1. FIRST CLASS AC - RS 6000 PER PERSON
2. SLEEPER - RS 3000 PER PERSON
TNUMBER 2: JAMMU EXPRESS FROM NEW DELHI
1. FIRST CLASS AC - RS 10000 PER PERSON
2. SLEEPER - RS 7000 PER PERSON

Enter your choice of train name: 1

Enter your choice of ticket: 1


How many tickets do you need? 5

You have chosen first class AC ticket.


Your total ticket price is = 30000.

Enter your choice: 13

Show the status of ticket


pname status
0 Ankit Kumar conf
1 Mahinder conf
2 Meena Rai conf
3 Rohan Gupta conf
4 Yashika Kaul conf
5 Nikhil Saini conf
6 Mehul Saini conf
7 DOLI conf
Enter your choice: 14

Top 2 rows
pname age train no no of pas cls destinatic amt status \
0 Ankit Kumar 47 4347 1 Ac1 goa 6000 conf
1 Mahinder 54 5353 2 sleeper jammu 10000 conf

pnrno
0 G1001
1 G1002
Last 2 rows
pname age train no no of pas cls destinatic amt status \
6 Mehul Saini 23 8907 2 sleeper goa 4000 conf
7 DOLI 34 2890 1 sleeper rajasthan 7899 conf

pnrno
6 G1007
7 G1008

Enter your choice: 15

Line plot
Enter your choice: 16
Enter your choice: 17

Bar plot
Enter your choice: 18

Bar plot
Enter your choice: 19

Horizontal bar plot


Enter your choice: 20

Horizontal bar plot

You might also like