CERTIFICATE
Department of chemical engineering
MVGR College of Engineering (A),Vizianagram
This is to certify that the project report entitled by RAILWAY RESERVATION SYSTEM
respectively, in partial fulfillment for the award of the degree of "Bachelor of Technology"
in Computer Science and Engineering is a record of Bonafide work done by
S.no Name of the Student Regd no Project Assigned
1. B. Pavan Kumar 20331A0805 Railway Reservation System
2. E. Swathi 20331A0810 Railway Reservation System
3. M. Rama Krishna 20331A0827 Railway Reservation System
4. S. Chandra Sekhar 20331A0839 Railway Reservation System
5. U. V. Sujith Varma 20331A0846 Railway Reservation System
6. Y. Devi 20331A0851 Railway Reservation System
them during the academic year 2021-2022.
under the supervision
M. Priyanka
M.TECH(CSE)
ASSISTANT PROFESSOR
CSE
INDEX
• OBJECTIVE
• PROJECT OVERVIEW
• IMPLEMENTATION
• SOURCE CODE
• OUTPUTS
• CONCLUSION
OBJECTIVE :-
As the name suggests Railway Reservation System is software that handles the entire booking data
of the Railway. It is fully based on the concept of reserving train tickets for various destinations.
Previously the task of handling the tickets at a time was very difficult, so there was a need for
software that can handle all Railway Reservation System.
Therefore, the Railway Reservation System was designed. After the release of this system, the stress
and workload of the employee were absolutely finished. It was also time-wasting for the travelers to
book a Ticket previously. But now it hardly takes 10 to 15 minutes to book a ticket wherever the
passenger is.
PROJECT OVERVIEW :-
The project “railway reservation system” is a sample project for reserve the tickets through the
internet. The project aims to develop an online ticket reserving system using java programming
language.
Implementation :-
>>We have created separate logins for the passengers as well as admin, in which the admin login
is password protected.
>>In this project, the admin can add, update, delete and create the trains.
>>The passenger can book the train only if the train is added by the admin.
>>Passengers are able to see the actual data of available trains so that they can choose which
they want.
>>The entire rights are given to the admin adding, modifying and deleting the train.
>>This project use concept of file handling to store the booking data.
>>Cancelling the ticket is a main feature of this project.
>>Admin is able to change the password of login.
SOURCE CODE:-
// Program to illustrate IOStreams - Storing & Retrieving records on file
// Railway Reservation System
import java.util.*;
import java.io.*;
class Train
{
Scanner s = new Scanner(System.in);
int tno,sno;
String tname,pname;
double fair;
void getData()
{
System.out.print("\n\nEnter Train number ");
tno = s.nextInt();
s.nextLine(); // Reads the new-line character
System.out.print("Enter Train name ===> ");
tname = s.nextLine();
System.out.print("Enter Passenger name ");
pname = s.nextLine();
System.out.print("Enter Seat number ===> ");
sno = s.nextInt();
System.out.print("Enter Fair ==>");
fair = s.nextDouble();
}
void showData()
{
for(int i=1;i<=60;i++)
System.out.print("#");
System.out.printf("\nTrain Number %d", tno);
System.out.printf("\nTrain Name %s", tname);
System.out.printf("\nPassenger Name %s", pname);
System.out.printf("\nSeat Number %d", sno);
System.out.printf("\nFair %.2f\n", fair);
for (int i=1;i<=60;i++)
System.out.print("#");
System.out.println();
}
void doOperation(String fname) throws IOException
{
int cho;
do
{
System.out.print("\n\nl.Store;2.Retrieve; 3.Exit ; Your Choice [1|2|3]
....>");
cho = s.nextInt();
switch(cho)
{
case 1:
getData();
DataOutputStream dos =
new DataOutputStream(new FileOutputStream(fname, true) ) ;
dos.writeInt(tno);
dos.writeInt(sno);
dos.writeUTF(tname);
dos.writeUTF(pname);
dos.writeDouble(fair);
dos.close();
break;
case 2:
DataInputStream dis = new DataInputStream(new
FileInputStream(fname));
while(true)
{
try
{
tno = dis.readInt();
sno = dis.readInt();
tname = dis.readUTF();
pname = dis.readUTF();
fair = dis.readDouble();
}
catch(EOFException e)
{
break;
}
showData();
}
dis.close();
break;
case 3 :
break;
default:
System.out.println("Invalid option !");
}
} while(cho!=3);
}
}
public class RailwayReservation
{
public static void main(String args[]) throws IOException
{
Train t = new Train();
t.doOperation (args [0] ) ;
}
}
output:-
CONCLUSION :-
In this way, we’ve created and executed the Railway Reservation System Project in java