ORRP
ORRP
ORRP
I, Pushpesh Kumar, student of Master of Computer Application hereby declare that the Dissertation
titled “ Online Railway Reservation System ” which is submitted by me to Department of Computer
Application, Amity School of Information Technology, Amity University Jharkhand, in partial
fulfillment of requirement for the award of degree of Master of Computer Application, has not been
previously formed the basis for the award of any degree, diploma or other similar title or recognition.
Date:
I
CERTIFICATE
To the best of my knowledge this work has not been submitted in part or full for any Degree or
Diploma to this University or elsewhere.
Date:
II
ACKNOWLEDGEMENT
I would like to express my sincere gratitude toward my vice-chancellor “Dr Raman Kumar Jha
(VC. AUJ)” for his completing this dissertation work.
It’s my great pleasure to thank my director “A.K Pandey (Director. AUJ)” for his assistance,
valuable suggestion and encouragement in completing this dissertation successfully.
My sincere thanks also goes to Mr. D B Cooper (Sr. Project Manager) who provided me an
opportunity to join their company as intern, and who gave access to office and all facilities. Without
they precious support it would not be possible to conduct this dissertation.
I would like to express my sincere gratitude to my internal guide Dr. Soni Sweta (Assist Prof. AUJ)
for the continuous support of my dissertation and related work, for his patience, motivation, and
immense knowledge. His guidance helped me in all the time of dissertation and writing of this
document. I could not have imagined having a better advisor and mentor for my dissertation work.
I would like to thank the all staff of AUJ family for supporting and me to completing the dissertation
work.
I would like to thank my friends for accepting nothing less than excellence from me., I would like to
thank my family my parents and to my brothers and sister for supporting me spiritually throughout
writing this thesis and my life in general.
Last but not the least, I also thanks to god for successfully completing the dissertation work.
III
Synopsis of Dissertation
Program: MCA
Student Signature :
Guide Signature :
IV
Abstract
Online Railway Reservation System Is basically an approach to know the main railway
reservation application which is a govt. Support software system which enables the end user to
perform booking and various other action regarding train,its routes, availability,cancellation etc.
The main aim behind developing this project is to bring change in the environment of desktop
booking done by the appointed staff. As the present version of booking application is developed on
c++ which not fully Object Oriented and there is small difficulty using railway api in C++ with
respect to Java which is much more comfortable to use and provide high end security and testing is
even easy with respect to C++.In this application I have focused data to store in a function for a
particular session of time to reduce the use of database to avoid traffic over server which enables a
server to serve quick and efficient.In this there project as I have used SQL as my database if I have
used the MongoDb( NOSQL) type database the scalability of the System will increase.
In future Scope I can say this project can be enhanced by using REST API provided by Indian Rail
and start booking from this project only.
V
Summary
Online Railway Reservation System Is basically an approach to know the main railway reservation
application which is a govt. Support software system which enables the end user to perform booking
and various other action regarding train,its routes, availability,cancellation etc.
The main aim behind developing this project is to bring change in the environment of desktop booking
done by the appointed staff. As the present version of booking application is developed on c++ which
not fully Object Oriented and there is small difficulty using railway api in C++ with respect to Java
which is much more comfortable to use and provide high end security and testing is even easy with
respect to C++.In this application I have focused data to store in a function for a particular session of
time to reduce the use of database to avoid traffic over server which enables a server to serve quick
and efficient.In this there project as I have used SQL as my database if I have used the MongoDb(
NOSQL) type database the scalability of the System will increase.
IN future Scope I can say this project can be enhanced by using REST API provided by Indian Rail
and start booking from this project only.
VI
Resource Requirement
Hardware Platform:
System Model : Aspire ES 15
Processor : Intel Celeron Processor N3050
RAM : 4 GB
Hard disk : 500 GB
Software Platform:
Operating System : Windows 10
Compiler : Java Compiler
Platform : Netbeans 8.0.2
VII
Justification
Justification means, “ We are bound to assure that all the functions mentioned in this project is able
to perform its all functionality “..
This application is just an advanced version of the older version with more interactive design
and faster working and this is going to work much faster as the server usage is tried to minimise
and hence fetching the data from database become easier.As a whole the project is justified by BMC
for testing purpose and the agreed that the project is liable for the future scope.
VIII
Schedule of Dissertation work completion
The dissertation work is schedule for the14th week.
IX
TABLE OF CONTENTS
Title Page No.
Declaration i
Certificate ii
Dedication iii
Acknowledgement iv
Abstract v
Table of Contents xii
List of Figures xviii
List of Tables xx
List of Abbreviations xxi
List of Symbols xxv
1.1 Purpose 6
1.2 Scope 6
1.3 Overview 6
1.4 The Overall Description 7
Chapter 5: Conclusion 26
Chapter 6: Limitation and Future Scope 27-29
Chapter 7: References and Bibliography 30
Chapter 8: Appendix 31-65
XI
LIST OF FIGURES
3.1 E R Diagram 17
3.2 DFD Diagram 18
3.3 Use Case Diagram 19
3.4 Sequence Diagram 20
3.5 Data Dictionary 21
XII
LIST OF TABLES
XIII
LIST OF ABBRIVATION
Abbr.. Description
GB Giga Byte
CRU
Create ,Read Delete and Update
D
B2B Business-To-Business
ER Entity Relationship
OS Operating System
XIV
LIST OF SYMBOLS
Symbols Description
← Implication
∑ Summation
ƒ Function
XV
Chapter 1:INTRODUCTION
In this emerging world of computers, almost all-manual system has switched to automated
and computerized system. Therefore, we are developing the software for “Online Railway
Reservation System” to model the present system and to remove the drawbacks of the
present system. This project explores how computer technology can be used to solve the
problem of user.
This being a big step in terms of improvement in the railway system it is widely accepted
across the country. Rather than designing manually, we have made use of computer. Use
of computer has solved many problems, which are faced during manual calculation. Once
data are fed, it can perform accurate functions. Therefore, to reduce the complexity and
efficiency a versatile and an outsourcing railway reservation system has been developed.
This project introduces railway reservation system. It explains how reservation is being
done in Indian Railways. The systematic procedure is explained. This project is developed
in Java language. All most of the package have been used in this project. Proper comments
have been given at desired locations to make the project user friendly. Various functions
and structures are used to make a complete use of this language.
The customers are required to register on the server for getting access to the database and
query result retrieval. Upon registration, each user has an account that is essentially the
‘view level’ for the customer. The account contains comprehensive information of the user
entered during registration and permits the customer to get access to his/her past
reservations, enquire about travel fare and availability of seats, make fresh reservations,
and update his account details. Each passenger is allotted a unique PNR no. through which
one can access his/her account.
1
administrator, one has access and right of modification to all the information stored in the
database. This includes the account information of the customers, attributes and statistics
of stations, description of the train stoppages and physical description of coaches, all the
reservations that have been made. The railway administrator has the right to modify any
information stored at the server database.
This project is dedicated to model the existing railway reservation system that aims at
development of Railway Reservation System that facilitates the railway customer to
manage their reservations and the railway administrator to modify the backend database in
a user-friendly manner. The customer and the railway administrator are two parties that
interact with the database, who have different ‘view level schemas’ to the database
information. The software provides a comprehensive set of features to enhance the
operational limits.
Now one can easily plan the journey comfortably as the process is efficient and fast with
being easy to access. The efficiency of the railway will increase result of computerization.
2
TECHNOLOGY (TOOLS AND CONTENTS)
Platform Used:
Hardware Platform:
System Model : Aspire ES 15
Processor : Intel Celeron Processor N3050
RAM : 4 GB
Hard disk : 500 GB
Software Platform:
Operating System : Windows 10
Compiler : Java Compiler
Platform : Netbeans 8.0.2
3
SOFTWARE REQUIREMENT SPECIFICATION
The initial specifications of user requirements may be based on interviews with the
database users and on the designers own analysis of the enterprise. The basic issues that
the SRS writer(s) shall address are the following:
Functionality:
External interfaces.
How does the software interact with people, the system’s hardware, other hardware,
and other software?
Performance.
What is the speed, availability, response time, recovery time of various software
functions, etc.?
Attributes.
4
An SRS should be:
a) Correct
b) Unambiguous
c) Complete
d) Consistent
f) Verifiable
g) Modifiable
h) Traceable
5
1.1 PURPOSE:
The purpose of this software is to describe the Railway Reservation System which
provides the rail timing details, reservation, enquiry, billing and cancellation on
various types of reservation namely:-
Confirm reservation for confirm seat
PNR generation
1.2. SCOPE:
The scope of this project is limited to an engineering college. This project aims to
maintain passenger and train information.
Other scopes of this project are as follows:
Freight Revenue enhancement
Passenger Revenue enhancement
Improved and optimised service
1.3. OVERVIEW:
This project aims at development of a Railway Reservation System that facilitates the
Railway customers to manage their reservations and the Railway administrators to
modify the backend databases in a User-Friendly manner.
3) Modify
4) Display record
6
5) Ticket reservation
6) Ticket Modification
7) Ticket Cancellation
7
1.4.5. COMMUNICATION INTERFACE:
Indian Railway’s website www.indianrail.gov.in PRS enquires
regarding Berth availability, Passenger Status, Fare, Train Schedule
etc.
National Train Enquiry System (NTES) website
www.trainenquiry.com gives dynamic information about the running
status of any train and its expected arrival/departure at given station.
Mobile telephone based SMS enquiry service. A new phone based
facility for rail users’ viz.,
Country wide extension of Universal Rail Enquiry number “139”
through setting up of Interactive Voice Response System (IVRS)
1.5.2. RESERVATION:
8
After checking the number of seats available, the customers reserve the
tickets.
1.5.3. BILLING:
After reserving the required number of tickets, the customer paid the fare.
1.5.4 CANCELLATION:
If the customer wants to cancel the ticket, he can cancel it using PNR
number.
1.8. CONSTRAINTS:
Administrator:
Database Management:
9
Control fare management.
View the details of all orders and control the whole application
Customers:
Login:
Customers must have a valid login id (PNR number) to enter into the
site.
Registration:
Cancel Details
SPECIFIC REQUIREMENTS:
1.9.1. PERFORMANCE REQUIREMENTS:
1AC
2AC
3AC
Sleeper
10 types of trains
4 types of classes
10
Reliable
Available
Secure
Portable
11
REQUEST TO RESERVE TICKET:
Passenger requests the clerk to reserve his/her ticket.
INPUT DETAILS:
Clerk asks customer to enter details for the reservation of ticket.
RESERVE TICKET:
Ticket is reserved and customer pays the fare.
13
Chapter 2:
Literature Review
Indian Railway Reservation related concept we are included in this part of the literature
survey, this includes some existing research work whose concept has already been done by
the researcher, apart from that we also find the only limitation in the same submitted. mode
of transportation in the country. As the backbone of the nation's transportation system,
Indian Railway owns more than 25,000 wagons, 45,000 different types of coaches and
8,000 locomotives. The system carries around 5,000 million passengers. The (IMPRESS)
was the first passenger reservation system stands for Integrated Multi-train Passenger
Reservation System, which could handle the functional requirements of reservation,
request, accounting and graphs. This document examines the need for the development of
an automated passenger reservation system for Indian railways. The passenger (IMPRESS)
is based on online transaction processing. (IMPRESS) that was later developed into a single
imaging system called Countrywide Network or Computerized Enhanced Reservation
(CONCERT). This article then discusses the overall architecture of the system, which
consists of a triple client-server architecture. Apart from the obvious advantage that it is
automated through manual reservation and inquiry, this document examines other benefits
of implementing this system and its future. Computer-controlled passenger reservation
system for Indian railways. This document presents the
Railway Reservation System located in Bapat Chourah, Indore, M.P, India, after studying
the advantages and disadvantages of the system structure, this paper recommends changing
the current queuing system to an alternative queuing system to avoid passenger
inconvenience. It has been proven that this model of the queuing system is feasible and the
results are effective and practical. Alternative waiting line system for tatkal rail reservation
system AASRFC Digital business is the need of the hour, 'digitizing or decaying' is the
slogan for every company of companies in the physical world, whether it is small, medium
or large. The current study is about the study of e-ticketing services in India with special
reference to the IRCTC (Indian Railway Catering & Tourism Corporation Ltd). The study
also addresses the consumer's perspective on IRCTC e-ticketing services. Analysis shows
that consumer perception of IRCTC e-ticketing services is positive, but there are some
issues that need to be resolved. This document proposes the Dynamic Seat Allocation
(DSA) system in view of the advantage of the standards for wireless communication. In
addition, dynamic authentication with the wireless device is built in that is specific to the
passenger. Through this research article, our approach is to make fair processing in seat
reservation or assignment in Indian Railway. Palmtop is connected to the central server.
This would show the
14
status of availability of seats on the rail network and could be booked by anyone who is
willing to travel on the train at the coming stations. But here we propose that if there are
waiting list
passengers and if a seat is available during their journey, the seat is provided to the
passenger who
has waiting list 1, which means that the available seat is allocated based on who comes
first, first served. was developed by the Center for Railway Information System (CRIS), a
public sector railway company that provides advice and IT services to the human
transportation system. This system is currently operational in Amritsar, Ajmer and
Dehradun Shatabdi Express. In their newspaper, they suggested an auction-based
mechanism for selling the tickets to passengers in need. They used the fact that a fixed
price is charged for different distances during TATKAL bookings, meaning that Indian
Railway loses a considerable amount. But we also aim to ask for a higher fixed price for a
fixed time interval, so that the other regular customers are not affected by this change.
Indian Railway Catering and Tourism Corporation Limited (I.R.C.T.C), the online site for
booking Indian Railways tickets, is also the largest Indian e-commerce website. With more
than 450,000 ticket bookings in a day and more than 800,000 views between 10:00 a.m.
and 12:00 p.m.
servers. Since the site with a bandwidth of 450 mbps cannot book more tickets than at the
moment, here are some suggestions that could improve the successful transaction ratio and
also help the in-emergency passengers to get tickets easily, but at a higher cost.
In this study we will investigate the impact of cloud-based rail reservation system on
passengers and the government. Here we explain Service Oriented Architecture (SOA) for
cloud-based e-ticketing rail reservation system, how Indian Railway Catering and Tourism
Corporation (IRCTC) can simplify tatkal booking, features of proposed system
architecture, benefits of the proposed system and problems and challenges. UTS ticketing
via the computer and automated reservation card system arose in the middle of the Indian
railways in mid-1985 with a solution of automation in the ticketing system and monitoring
the status of the reserved ticketing, but it creates a number of problems with this new
implemented system, this paper deals with the solutions to the problems of time use during
the ticketing process in the Indian railways and the payment method other than stated by
the Indian railways while they have taken over the ticket from their ticket counters.
15
Motive:
Online Railway Reservation System Is basically an approach to know the main railway
reservation application which is a govt. Support software system which enables the end
user to perform booking and various other action regarding train,its routes,
availability,cancellation etc.
The main aim behind developing this project is to bring change in the environment of
desktop booking done by the appointed staff. As the present version of booking application
is developed on c++ which not fully Object Oriented and there is small difficulty using
railway api in C++ with respect to Java which is much more comfortable to use and provide
high end security and testing is even easy with respect to C++.In this application I have
focused data to store in a function for a particular session of time to reduce the use of
database to avoid traffic over server which enables a server to serve quick and efficient.In
this there project as I have used SQL as my database if I have used the MongoDb( NOSQL)
type database the scalability of the System will increase.
IN future Scope I can say this project can be enhanced by using REST API provided by
Indian Rail and start booking from this project only.
16
Chapter 3:Methodology
E-R DIAGRAM
NAME NAME
PNR No. AGE
RESER RESERVAT
CUSTOMER
VE ION
OFFICER
GENDER DEPT.
AGE
DEPT.
ENQUIRY
ENQUIRY
OFFICER
AGE
NAME
Fig 3.1
17
DATA FLOW DIAGRAM
0-LEVEL DFD
Payment
COUSTMER ENQUIRY
Request for Form
OFFICER
Submit Form
Confirmation
Rejection 1.
Check for Status Enquiry
RAILWAY
Request for Reservation Answer to enquiry
RESERVATION
Request for enquiry
SYSTEM
Issue Form
Ticket Printing
Fig 3.2
18
USE CASE DIAGRAM
LOGIN
ADMINISTRATOR
VIEW RESERVATION
STATUS PASSENGER
RESERVE SEAT
VIEW TRAIN
SCHEDULE
RESERVATION CANCELLATION
CLERK
Fig 3.3
19
SEQUENCE DIAGRAM
1. Request timetable
2. Display timetable
3. Request to reserve ()
4. Input details
5. Calculate fare
6. Reserve ticket
7. Request to print
ticket
8. Print Ticket
9. Request to cancel
ticket
10. Cancel Ticket
20
DATA DICTIONARY
(Fig 3.5)
21
Fig(3.1) Login Table
22
Train Table (Fig 3.2)
23
Chapter 4:Result and Analysis
4.Testing
Software testing is a critical element of software quality assurance andrepresents the
ultimate review of specification, design and code generation.Once source code has been
generated, software must be tested to uncover as many errors as possible before delivery
to the customer. Our goal is to design a series of test cases that have a high likelihood of
finding errors. That’s where software testing techniques come into the picture. These
techniques provide systematic guidance for designing tests that exercise the internal logic
of software components and exercise the input and output domains of the program to
uncover errors in program function,behavior and performance.
4.1.System Testing
As the part of system testing we execute the program with the intent of finding errors and
missing operations and also a complete verification to determine whether the objectives
are met and the user requirements are satisfied. The ultimate aim is quality assurance.
Tests are carried out and the results are compared with the expected document. In the case
of erroneous results, debugging is done. Using detailed testing strategies a test plan is
carried out on each module. The various tests performed are unit testing, integration testing
and user acceptance testing.
The whole system is not work properly because the database in not properly work for this
software.
4.2.Unit Testing
Testing of an individual software component or module is termed as unit testing .It is
typically done by the programmers and not by testers, as it requires a detailed knowledge
of the internal program design and code. As a part of unit testing we executed the program
24
for Individual modules independently. This enables, to detect errors in coding and logic
that are contained within each of the module. This testing includes entering data that is
filling forms and ascertaining if the value matches to the type and entered into the database.
The various controls are tested to ensure that each performs its action as required.
4.3.Integration Testing
Data can be lost across any interface; one module can have an adverse effect on another,
sub Functions when combined may not produce the desired major functions. Integration
testing is a Systematic testing to discover errors associated within the interface. The
objective is to take unit tested modules and build a program structure. All the modules are
combined and tested as a Whole. Here the admin module, sec module and student module
options are integrated and tested. This testing provides the assurance that the application is
well integrated functional unit with smooth transition of data.
4.4.User Acceptance Testing
User acceptance of a system is the key factor for the success of any system. The system
under consideration is tested for user acceptance by constantly keep the records of
applicants and making changes to the details and password whenever required.
4.5.Test case :-
1. Test case of the login page :- When we enter a number in user name then a
dialogue box show that only enter alphabet.
2. Test Case of the User Verification :- When we enter a user name and password
to the verification form, it takes input but when we submit the form the exception
is generated.
3. In testing phase, the Logout button is missing from all pages. So we improve the
design as well as java code.
4. In all the form this type of this test case is in all the form.
5. And the exception is same for the all form.
Chapter 5:Conclusion
25
The main aim behind developing this project is to bring change in the environment of
desktop booking done by the appointed staff. As the present version of booking application
is developed on c++ which not fully Object Oriented and there is small difficulty using
railway api in C++ with respect to Java which is much more comfortable to use and provide
high end security and testing is even easy with respect to C++.In this application I have
focused data to store in a function for a particular session of time to reduce the use of
database to avoid traffic over server which enables a server to serve quick and efficient.In
this there project as I have used SQL as my database if I have used the MongoDb( NOSQL)
type database the scalability of the System will increase.
IN future Scope I can say this project can be enhanced by using REST API provided by
Indian Rail and start booking from this project only.
Chapter 6: LIMITATIONS
26
Our project meets the following limitations:
1) The software is not able to reserve tickets for more than 6 people at a time per
train.
2) The fare allotted for every reservation is independent of Kilometres travelled
instead it is set for every mode (AC, Non-AC or General) of each train.
3) The software is made such to carry out reservation in max 5 trains.
4) The software does not support multi-day reservation system, i.e., the reservations
cannot be done in advance rather it is carried out for single day.
5) The software does not provide concession in fare rates for children, aged people,
armament etc. i.e., the fare identical for all people.
6) The software does not take into consideration the stations falling in between the
source and destination station.
27
FUTURE SCOPE
If anyone wants to extend this project then he/she can make an additional database of Train
Fare. And database for updated availability of seats which is available after the cancellation
of ticket on that specific train etc. He/she can also add some more command buttons in the
existing software and extend working of the existing software.
Implementations of this project idea are in industrial use. Hence, this can be used for
suggesting improvements in design, performance and greater usability. Apart from the
industrial applications, it is a research-oriented project as well, the task of performance
evaluation of different database designs, for efficiency, is in this spirit.
28
Chapter 7:
REFERENCES AND BIBLIOGRAPHY
1. Golub GH, LeVeque RJ (1979). “Extensions and Uses of the Variable Projection
Algorithm for Solving Nonlinear Least Squares Problems.” In Proceedings of the
1979 Army Numerical Analysis and Computers Conference, volume ARO Report
79-3, pp. 1–12.
2. Briand LC, Daly JW, Wüust JK (1999) A unified framework for coupling
measurement in objectoriented systems. IEEE Trans Softw Eng 25(1):91–121
3. Hautus E (2002) Improving Java software through package structure analysis. In:
The 6th IASTED International Conference Software Engineering and Applications
Jungmayr S (2002) Identifying test-critical dependencies. In: ICSM, pp 404–413.
4. Briand LC, Daly JW, Wüust JK (1999) A unified framework for coupling
measurement in objectoriented systems. IEEE Trans Softw Eng 25(1):91–121
Book Used
1. BMC Library (Documentation)
29
Chapter 8: Appendix
/*
*/
package railway;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* @author acer pc
*/
String from,to,tno,tname,date,pnr;
Connection conn=null;
30
String []pref=new String[5];
int i=0;
this.from=from;
this.to=to;
this.tno=tname;
this.tname=tno;
this.date=date;
this.pnr=pnr;
conn=ct.dbConnect();
PreparedStatement pst=conn.prepareStatement(query);
ResultSet rs=pst.executeQuery();
while(rs.next())
n1[i]=rs.getString("name");
age[i]=rs.getInt("age");
31
sex[i]=rs.getString("sex");
pref[i]=rs.getString("preference");
cat[i]=rs.getString("category");
mob[i]=rs.getInt("mobile");
pan[i]=rs.getString("id_type");
id_no[i]=rs.getString("id_no");
i++;
public ShowTicket() {
initComponents();
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
*/
@SuppressWarnings("unchecked")
32
jLabel2 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
addWindowListener(new java.awt.event.WindowAdapter() {
formWindowOpened(evt);
});
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
33
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/railway/Images/index -
Copy.jpg"))); // NOI18N
jLabel1.setOpaque(true);
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel2.setText("Train Name");
jLabel2.setOpaque(true);
jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel3.setText("Date");
jLabel3.setOpaque(true);
34
jLabel4.setFont(new java.awt.Font("Segoe UI Semilight", 1, 14)); // NOI18N
jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel4.setText("From");
jLabel4.setOpaque(true);
jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel5.setText("To");
jLabel5.setOpaque(true);
jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel6.setText("Pnr");
jLabel6.setOpaque(true);
jTextField1.setHorizontalAlignment(javax.swing.JTextField.CENTER);
jTextField1.addActionListener(new java.awt.event.ActionListener() {
jTextField1ActionPerformed(evt);
35
}
});
jTextField2.setHorizontalAlignment(javax.swing.JTextField.CENTER);
jTextField3.setHorizontalAlignment(javax.swing.JTextField.CENTER);
jTextField4.setHorizontalAlignment(javax.swing.JTextField.CENTER);
jFormattedTextField1.setFormatterFactory(new
javax.swing.text.DefaultFormatterFactory(new javax.swing.text.DateFormatter()));
jFormattedTextField1.addActionListener(new java.awt.event.ActionListener() {
jFormattedTextField1ActionPerformed(evt);
});
jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel7.setText("Train No");
jTextField5.setHorizontalAlignment(javax.swing.JTextField.CENTER);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
.addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
37
.addComponent(jFormattedTextField1, javax.swing.GroupLayout.PREFERRED_SIZE,
182, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addContainerGap(22, Short.MAX_VALUE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
38
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jFormattedTextField1, javax.swing.GroupLayout.PREFERRED_SIZE,
36, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 35,
Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
);
jScrollPane1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0,
0, 0), 4));
jTextArea1.setColumns(20);
jTextArea1.setRows(5);
jScrollPane1.setViewportView(jTextArea1);
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane1)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
40
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 85,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addContainerGap())
);
pack();
}// </editor-fold>
jTextField1.setText(tname);
jFormattedTextField1.setText(date);
jTextField2.setText(tno);
jTextField3.setText(from);
jTextField4.setText(to);
jTextField5.setText(pnr);
for(int j=0;j<i;j++)
41
{
jTextArea1.append(n1[j]);
jTextArea1.append("\t");
jTextArea1.append(age[j].toString());
jTextArea1.append("\t");
jTextArea1.append(sex[j]);
jTextArea1.append("\t");
jTextArea1.append(pref[j]);
jTextArea1.append("\t");
jTextArea1.append(cat[j]);
jTextArea1.append("\t");
jTextArea1.append(mob[j].toString());
jTextArea1.append("\t");
jTextArea1.append(pan[j]);
jTextArea1.append("\t");
jTextArea1.append(id_no[j]);
jTextArea1.append("\t");
jTextArea1.append("\n\n");
42
// TODO add your handling code here:
/**
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
*/
try {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
java.util.logging.Logger.getLogger(ShowTicket.class.getName()).log(java.util.logging.Level.SEVER
E, null, ex);
43
java.util.logging.Logger.getLogger(ShowTicket.class.getName()).log(java.util.logging.Level.SEVER
E, null, ex);
java.util.logging.Logger.getLogger(ShowTicket.class.getName()).log(java.util.logging.Level.SEVER
E, null, ex);
java.util.logging.Logger.getLogger(ShowTicket.class.getName()).log(java.util.logging.Level.SEVER
E, null, ex);
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
new ShowTicket().setVisible(true);
});
/////////////////////////////Supporting Classes////////////////////////////////
///////////////////////////////Connection Class///////////////////////////////
package railway;
import java.sql.Connection;
45
import java.sql.DriverManager;
import java.sql.SQLException;
String url="jdbc:mysql://localhost:3306/start";
String uname="root";
String pa="";
Class.forName(driver);
conn=DriverManager.getConnection(url,uname,pa);
return conn;
package railway;
import java.sql.Connection;
import java.sql.PreparedStatement;
46
import java.sql.ResultSet;
import java.sql.SQLException;
String user;
String pass1;
if(s1.equals(""))
user=s1;
pass1=String.copyValueOf(s2);
if(pass1.equals(""))
return "done";
Connection conn=ct.dbConnect();
System.out.println("check");
ResultSet a= pst.executeQuery();
int chk=0;
if(a.next())
if(pass1.equals(a.getString("pass")))
System.out.println("login successful");
chk=1;
return chk;
else
System.out.println("login unsuccessfull");
System.out.println(a.getString("pass"));
return chk;
else
System.out.println("login unsuccessfull");
48
return chk;
package railway;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* @author acer pc
*/
Connection conn=null;
String from,to,tno,tname,arr,dept,arto,dur,day;
49
public String[] getTrainInfo(String s1) throws ClassNotFoundException, SQLException{
conn=ct.dbConnect();
System.out.println("hello baby111");
pst.setString(1,s1);
System.out.println("hello babyp--pst");
System.out.println("hello baby");
int j=0;
while(rs.next())
System.out.println(rs.getString("FromStation"));
tra[0]=rs.getString("FromStation");
tra[1]=rs.getString("ToStation");
tra[2]=rs.getString("Train_Name");
tra[3]=rs.getString("Train_No");
tra[4]=rs.getString("Arrival");
tra[5]=rs.getString("Departure");
tra[6]=rs.getString("ArrivalTo");
tra[7]=rs.getString("Duration");
tra[8]=rs.getString("Day");
50
System.out.println(rs.getString("ToStation"));
System.out.println(rs.getString("Train_Name"));
System.out.println(rs.getString("Train_No"));
System.out.println(rs.getString("Day"));
System.out.println("hello baby");
System.out.println(tra[i]);
return tra;
51
///////////////////////// Search Route ////////////////////////////////////////
package railway;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
Connection conn=null;
String from,to,tno,tname,arr,dept,arto,dur,day;
conn=ct.dbConnect();
System.out.println("hello baby111");
pst.setString(1,s1);
pst.setString(2,s2);
System.out.println("hello babyp--pst");
52
ResultSet rs= pst.executeQuery();
System.out.println("hello baby");
int j=0;
/* while(rs.next())
j=j+4;
System.out.println(rs.getString("FromStation"));
tra[0]=rs.getString("FromStation");
tra[1]=rs.getString("ToStation");
tra[2]=rs.getString("Train_Name");
tra[3]=rs.getString("Train_No");
tra[4]=rs.getString("Day");
System.out.println(rs.getString("ToStation"));
System.out.println(rs.getString("Train_Name"));
System.out.println(rs.getString("Train_No"));
System.out.println(rs.getString("Day"));
System.out.println("hello baby");
}*/
int i=j=0;
53
while(rs.next())
ar[i][0]=(String)rs.getString("FromStation");
ar[i][1]=(String)rs.getString("ToStation");
ar[i][2]=(String)rs.getString("Train_Name");
ar[i][3]=(String)rs.getString("Train_No");
ar[i][4]=(String)rs.getString("Day");
System.out.println("hello baby");
i++;
for( i=0;i<5;i++)
for(j=0;j<5;j++)
System.out.println(ar[i][j]);
54
}
return ar;
package railway;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
Connection conn=null;
String from,to,tno,tname,arr,dept,arto,dur,day;
55
public Integer[] getTrainInfo(int s1,String d) throws ClassNotFoundException, SQLException{
conn=ct.dbConnect();
System.out.println("hello baby111");
pst.setInt(1,s1);
pst.setString(2,d);
System.out.println("hello babyp--pst");
System.out.println("hello baby");
int j=0;
while(rs.next())
System.out.println(rs.getString("Train_No"));
tra[0]=rs.getInt("Train_No");
// tra[1]=Integer.parseInt(rs.getString("Date"));
tra[1]=5;
tra[2]=rs.getInt("Sleeper");
tra[3]=rs.getInt("3AC");
tra[4]=rs.getInt("2AC");
tra[5]=rs.getInt("1AC");
56
System.out.println(rs.getInt("Train_No"));
System.out.println(rs.getString("Date"));
System.out.println(rs.getInt("Sleeper"));
System.out.println(rs.getInt("3AC"));
System.out.println(rs.getInt("2AC"));
System.out.println(rs.getInt("1AC"));
System.out.println("hello baby");
System.out.println(tra[i]);
return tra;
57
}
package railway;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
Connection conn=null;
String pnr;
String pan,id_no,chseat,date2,tno;
58
int cnt;
int mob;
this.pnr=pnr;
conn=ct.dbConnect();
System.out.println("hello baby111");
System.out.println(query);
PreparedStatement pst=conn.prepareStatement(query);
System.out.println("ishi mishi");
System.out.println("ishi mishi2");
int a=pst.executeUpdate();
System.out.println(a);
if(a>0)
else{
System.out.println("table is created");
59
}
return pnr;
@SuppressWarnings("ConvertToStringSwitch")
this.pnr=pnr;
this.n1=name;
this.age=age1;
this.sex=sex1;
this.pref=pref1;
this.cat=cat1;
this.mob=mob1;
this.pan=pan1;
this.id_no=id_no1;
this.cnt=cnt1;
this.chseat=seat;
this.date2=date1;
this.tno=tno1;
Date di;
60
Date date;
date=Date.valueOf(date1);
int tno2=Integer.parseInt(tno);
conn=ct.dbConnect();
System.out.println("hello baby111");
int a=0;
for(int i=0;i<cnt;i++)
PreparedStatement pst=conn.prepareStatement(query);
pst.setString(1,n1[i]);
pst.setInt(2,age[i]);
pst.setString(3,sex[i]);
pst.setString(4,pref[i]);
pst.setString(5,cat[i]);
pst.setInt(6,mob);
pst.setString(7,pan);
pst.setString(8,id_no);
System.out.println("ishi mishi2");
a=pst.executeUpdate();
if(a>0)
{
61
System.out.println("ticket successfull");
String query1,ch,query2;
int seatvar=0;
if(chseat.equals("SL"))
ch="Sleeper";
else if(chseat.equals("3AC"))
ch="3AC";
else if(chseat.equals("2AC"))
ch="2AC";
else
ch="1AC";
conn=ct.dbConnect();
System.out.println("ticket successfull");
62
PreparedStatement pst1=conn.prepareStatement("Select * from avail where
Train_No=? and Date=? ");
pst1.setInt(1,tno2);
pst1.setString(2,date2);
System.out.println("ticket successfull");
ResultSet rs1=pst1.executeQuery();
while(rs1.next())
seatvar=rs1.getInt(ch);
if(chseat.equals("SL"))
seatvar=seatvar-cnt;
System.out.println(query2);
ch="Sleeper";
else if(chseat.equals("3AC"))
seatvar=seatvar-cnt;
System.out.println(query2);
ch="3AC";
63
}
else if(chseat.equals("2AC"))
seatvar=seatvar-cnt;
System.out.println(query2);
ch="2AC";
else
seatvar=seatvar-cnt;
query2="UPDATE avail SET 1AC= "+seatvar+ " WHERE Train_No=? AND Date=?";
System.out.println(query2);
ch="1AC";
conn=ct.dbConnect();
PreparedStatement pst2=conn.prepareStatement(query2);
pst2.setInt(1,tno2);
pst2.setDate(2,date);
int b=0;
b=pst2.executeUpdate();
if(b>0)
64
{
else{
else{
65
66