Anda di halaman 1dari 81

DECLARATION

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.

Amity University Jharkhand, Ranchi

Date:

Sign. of the Student

Name of Student: Pushpesh Kumar

Enrollment Number: A35400716012

I
CERTIFICATE

On the basis of Dissertation submitted by Pushpesh kumar, student of Master in Computer


Application, I hereby certify that the Dissertation “ Online Railway Reservation System” which is
submitted to Department of Computer Application, School of Amity Institute of Information
Technology, Amity University Jharkhand in partial fulfillment of requirement for the award of the
degree of Master of Computer Application is an original contribution with existing knowledge and
faithful record of work carried out by him/her under my guidance and supervision.

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.

Amity University Jharkhand, Ranchi

Date:

Signature of Guide (Internal) Signature of Guide (External)


DR. SONI SWETA Name:

Assistant Professor Designation:

Department of Computer Application

Amity University Jharkhand, Ranchi

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

Dissertation Title: Online Railway Reservation System

Name of the Guide: Dr. Soni Sweta

Program: MCA

Year/Semester: 6th Sem

Enrollment No: A35400716012

Student Signature :

Guide Signature :

(Dr. Soni Sweta)

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.

 Week 1: Approval for the dissertation in the BMC India.


 Week 2: Assign the area and give the over view of the company and the work
And also give the knowledge about the projects.
 Week 3: Start learning about Java. And also start work on the designing part.
 Week 4: Learn, how to install all the application for the development as Netbeans,
SQL Server,etc.
 Week 5: Learn about the database and read out the document of some project for
database knowledge.
 Week 6: Assigned me project and give task to start developing and understand how
to develop app. Design database and connect to it.
 Week 7: Try to design Login Page.
 Week 8: Design , login page and Train Page
 Week 9: Write code for the connection interaction.
 Week 10: Customer interaction and improve the code and design.
 Week 11: Design and write code for the connection to database.
 Week 12: Write code for another activity like matter, support, time sheet.
 Week 13: Write code for the all activity like menu model,Searching Train
List, Pnr ,Booking,etc.
 Week 14: Creating and Building JAR file in Netbeans and launch the app..

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

Chapter -1 Introductory 1-13

1.1 Purpose 6
1.2 Scope 6
1.3 Overview 6
1.4 The Overall Description 7

1.4.1 Product Perspective 7


1.4.2 System Interface 7
1.4.3 Hardware Interface 7
1.4.4 Software Interface 7
1.4.5 Communication Interface 8
1.4.6 Memory Constraints 8
1.4.7 Operations 8

1.5 Product Functions 8

1.5.1 Train Details 8


1.5.2 Reservation 9
1.5.3 Billing 9
X
1.5.4 Cancellation 9

1.6 User Characteristic 9


1.7 Constraints 9
1.8 Specific Requirements 10

1.8.1 Performance Requirement 10


1.8.2 Software System Attributes 11

1.9 Functional Requirements 11

1.9.1 Reservation of Tickets 12


1.9.2 Cancellation of Tickets 12

1.10 Non Functional Requirements 13

Chapter 2: Literature Review 14-15


Chapter 3: Methodology 16-23
Chapter 4: Result and Analysis 24-25
4.1 System Testing 24
4.2 Unit Testing 24
4.3 Integration Testing 25
4.4 User Acceptance Testing 25
4.5 Test Case 25

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

Figure Description Page


No. No.

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

Table Description Page


No. No.

3.1 Login table 22


3.2 Train Table 23
3.3 23
Pnr Table

XIII
LIST OF ABBRIVATION

Abbr.. Description

GB Giga Byte

AWS Amazon Web Service

API Application Program Interface

CRU
Create ,Read Delete and Update
D

B2B Business-To-Business

DFD Data Flow Diagram

CEO Chief Executive Officer

ER Entity Relationship

GUI Graphical User Interface

MVC Model View Controller

OS Operating System

SRS System Requirement Specification

XIV
LIST OF SYMBOLS
Symbols Description

← Implication

∑ Summation

μ/m Membership Function

ƒ 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.

The railway administrator is another member involved in the transactions. The


administrator is required to login using a master password, once authenticated as an

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

A Software Requirement Specification (SRS) is a requirements specification for a software


system that is a complete description of the behavior of a system to be developed. It
includes a set of use cases that describe all the interactions the users will have with the
software. Use cases are also known as functional requirements. In addition to use cases,
the SRS also contains non-functional (or supplementary) requirements. Non-functional
requirements are requirements that impose constraints on the design or implementation
(such as performance engineering requirements, quality standards, or design constraints).

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:

What is the software supposed to do?

 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.

What is the portability, correctness, maintainability, security, etc. considerations?

4
An SRS should be:

a) Correct

b) Unambiguous

c) Complete

d) Consistent

e) Ranked for importance and/or stability

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.

This project includes the following functions:

1) Create new database

2) Add new Record

3) Modify

4) Display record

6
5) Ticket reservation

6) Ticket Modification

7) Ticket Cancellation

1.4.THE OVERALL DESCRIPTION:

1.4.1. PRODUCT PERSPECTIVE:


It enables us to maintain the railway train details like their timings, number of seat
available and cancelling the tickets.

1.4.2. SYSTEM INTERFACE:


 Keyboard
 Mouse

1.4.3 HARDWARE INTERFACE:


 System Model : Acer Aspire ES-15
 Processor : Intel Celeron Processor N3050
 RAM : 4 GB
 Hard disk : 500 GB

1.4.4. SOFTWARE INTERFACE:


 Operating System : Windows 10
 Compiler : Java
 Platform : Netbeans 8.0.2

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.4.6. MEMORY CONSTRAINTS:


1.4.7. OPERATIONS:
 Any Reservation counter from 8 am to 8 pm.
 One form for five persons.
 To save time and queue Agents are other guides.

1.5. PRODUCT FUNCTIONS:

It tells the short note about the product.

1.5.1. TRAIN DETAILS:


Customers may view the train number, train name, train timing (arrival and
departure), arrival and departure station of the train and number of seats
required.

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.7. USER CHARACTERISTICS:


 Knowledgeable User
 Novice User
 Expert User

1.8. CONSTRAINTS:

There is no maintainability of back up so availability will get affected. Real-life


credit card validation and Banking system is not implemented. No
multilingual support. Given below is an overall picture of the system, as
depicted in the above

Administrator:

Database Management:

 Control the database customers and keep track of all records of


customers.
 Control the database of trains and keep track of all records of train.

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:

 New users can sign up by creating new ID.

Cancel Details

 Can cancel his reservation details.

SPECIFIC REQUIREMENTS:
1.9.1. PERFORMANCE REQUIREMENTS:

It’s available during all 24 hours.

Variety of compartments based on comfort:

 1AC
 2AC
 3AC
 Sleeper

Types of concerns and complexities:

 10 types of trains
 4 types of classes

1.9.2. SOFTWARE SYSTEM ATTRIBUTES:

10
 Reliable
 Available
 Secure
 Portable

1.10. FUNCTIONAL REQUIREMENTS:


In software engineering, a functional requirement defines a function of a software-
system or component. A function is described as a set of inputs, the behavior and
outputs. Functional requirements may be calculations, technical details, data
manipulation and processing and other specific functionality that show how a use
case to be fulfilled. Typically, a requirements analyst generates functional
requirements after building use cases. However, this may have exceptions since
software development is an iterative process and sometime certain requirements
are conceived prior to the definition of the use case. Both artifacts (use cases
documents and requirements documents) complement each other in a bidirectional
process. A typical functional requirement will contain a unique name and number,
a brief summary, and a rationale. This information is used to help the reader
understand why the requirement is needed, and to track the requirement through
the development of the system. The core of the requirement is the description of
the required behavior, which must be a clear and readable description of the
required behavior. This behavior may come from organizational or business rule,
or it may be discovered through elicitation sessions with users, stakeholders and
other experts within the organization. Software requirements must be clear, correct
unambiguous, specific and verifiable.

1.10.1. RESERVATION OF TICKET:


 REQUEST TIME TABLE:
Passenger requests database to display railway timetable.
 DISPLAY TIMETABLE:
Database displays timetable to the customer.

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.

1.10.2. CANCELLATION OF TICKET:


 REQUEST TO CANCEL TICKET:
Customer requests to cancel his/her ticket for which he/she has to
give the PNR number.
 CANCEL TICKET:
Once the PNR number is received, the ticket is cancelled.

1.11. NON-FUNCTIONAL REQUIREMENTS:

In systems engineering and requirements engineering, non-functional


requirements are requirements that specify criteria that can be used to judge the
operation of system, rather than specific behaviors. Non-functional requirements
are often called qualities of a system. Other terms for non-functional requirements
are “constraints”, ”quality attributes”, “quality goals” and “quality of service
requirements” .
Qualities, i.e. non-functional requirements can be divided into 2 main categories:
1. Execution qualities such as security and usability are observable at run
time.
2. Evolution qualifies, such as extensibility and scalability embody in the
static structure of the software system.
The Non-Functional requirements of our project are:
 Time:
12
This project should be completed within the stimulated time period.
 Cost:
The cost involved in marketing the project should be less.
 Usability:
This requirement is present, as this system will interact with the user.
 Reliability:
This system must be highly robust.
 Performance:
It should be fast enough to produce output.

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

Application Form Conformation


RESERVATION
Payment Received Rejection
OFFICER

Fig 3.2

18
USE CASE DIAGRAM

UPDATE TRAIN INFO

LOGIN

ADMINISTRATOR

MODIFY TRAIN INFO

VIEW RESERVATION
STATUS PASSENGER

RESERVE SEAT

VIEW TRAIN
SCHEDULE

RESERVATION CANCELLATION
CLERK

Fig 3.3
19
SEQUENCE DIAGRAM

PASSENGER RAILWAY CLERK TICKET


DATABASE

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

NAME ALIAS USE CONTENT ADDITIONAL


INFORMATION

PNR Number None Enquiry PNR=rand() None


Reservation
Cancellation

(Fig 3.5)

21
Fig(3.1) Login Table

22
Train Table (Fig 3.2)

Pnr Table (Fig 3.3)

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.

The various types of testing system used are:


 Unit Testing
 Integration Testing
 User Acceptance Testing

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)

2. Core and Advanced Java ( Dreamtech Press)

3. The Complete Java (Schildt Herbert)

29
Chapter 8: Appendix

/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

package railway;

import java.sql.Connection;

import java.sql.PreparedStatement;

import java.sql.ResultSet;

import java.sql.SQLException;

/**

* @author acer pc

*/

public class ShowTicket extends javax.swing.JFrame {

String from,to,tno,tname,date,pnr;

Connection conn=null;

String []n1=new String[5];

String []sex=new String[5];

30
String []pref=new String[5];

Integer [] age =new Integer[5];

String []cat=new String[5];

String []pan=new String[5];

String []id_no=new String[5];

int i=0;

Integer []mob=new Integer[5];

public void sendDetails(String from,String to,String tno,String tname,String date,String pnr)


throws ClassNotFoundException, SQLException

this.from=from;

this.to=to;

this.tno=tname;

this.tname=tno;

this.date=date;

this.pnr=pnr;

connect ct=new connect();

conn=ct.dbConnect();

String query="Select * from "+pnr;

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

* regenerated by the Form Editor.

*/

@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code">

private void initComponents() {

jLabel1 = new javax.swing.JLabel();

jPanel1 = new javax.swing.JPanel();

32
jLabel2 = new javax.swing.JLabel();

jLabel3 = new javax.swing.JLabel();

jLabel4 = new javax.swing.JLabel();

jLabel5 = new javax.swing.JLabel();

jLabel6 = new javax.swing.JLabel();

jTextField1 = new javax.swing.JTextField();

jTextField2 = new javax.swing.JTextField();

jTextField3 = new javax.swing.JTextField();

jTextField4 = new javax.swing.JTextField();

jFormattedTextField1 = new javax.swing.JFormattedTextField();

jLabel7 = new javax.swing.JLabel();

jTextField5 = new javax.swing.JTextField();

jScrollPane1 = new javax.swing.JScrollPane();

jTextArea1 = new javax.swing.JTextArea();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

addWindowListener(new java.awt.event.WindowAdapter() {

public void windowOpened(java.awt.event.WindowEvent evt) {

formWindowOpened(evt);

});

jLabel1.setBackground(new java.awt.Color(204, 51, 0));

jLabel1.setFont(new java.awt.Font("Segoe UI Semilight", 1, 36)); // NOI18N

jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

33
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/railway/Images/index -
Copy.jpg"))); // NOI18N

jLabel1.setText("Railway Reservtion System");

jLabel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0),


4));

jLabel1.setOpaque(true);

jPanel1.setBackground(new java.awt.Color(153, 153, 153));

jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0),


4));

jLabel2.setBackground(new java.awt.Color(204, 51, 0));

jLabel2.setFont(new java.awt.Font("Segoe UI Semilight", 1, 14)); // NOI18N

jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel2.setText("Train Name");

jLabel2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

jLabel2.setOpaque(true);

jLabel3.setBackground(new java.awt.Color(204, 51, 0));

jLabel3.setFont(new java.awt.Font("Segoe UI Semilight", 1, 14)); // NOI18N

jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel3.setText("Date");

jLabel3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

jLabel3.setOpaque(true);

jLabel4.setBackground(new java.awt.Color(204, 51, 0));

34
jLabel4.setFont(new java.awt.Font("Segoe UI Semilight", 1, 14)); // NOI18N

jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel4.setText("From");

jLabel4.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

jLabel4.setOpaque(true);

jLabel5.setBackground(new java.awt.Color(204, 51, 0));

jLabel5.setFont(new java.awt.Font("Segoe UI Semilight", 1, 14)); // NOI18N

jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel5.setText("To");

jLabel5.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

jLabel5.setOpaque(true);

jLabel6.setBackground(new java.awt.Color(204, 51, 0));

jLabel6.setFont(new java.awt.Font("Segoe UI Semilight", 1, 14)); // NOI18N

jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel6.setText("Pnr");

jLabel6.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

jLabel6.setOpaque(true);

jTextField1.setFont(new java.awt.Font("Segoe UI Semilight", 1, 14)); // NOI18N

jTextField1.setHorizontalAlignment(javax.swing.JTextField.CENTER);

jTextField1.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jTextField1ActionPerformed(evt);

35
}

});

jTextField2.setFont(new java.awt.Font("Segoe UI Semilight", 1, 14)); // NOI18N

jTextField2.setHorizontalAlignment(javax.swing.JTextField.CENTER);

jTextField3.setFont(new java.awt.Font("Segoe UI Semilight", 1, 14)); // NOI18N

jTextField3.setHorizontalAlignment(javax.swing.JTextField.CENTER);

jTextField4.setFont(new java.awt.Font("Segoe UI Semilight", 1, 14)); // NOI18N

jTextField4.setHorizontalAlignment(javax.swing.JTextField.CENTER);

jFormattedTextField1.setFormatterFactory(new
javax.swing.text.DefaultFormatterFactory(new javax.swing.text.DateFormatter()));

jFormattedTextField1.setFont(new java.awt.Font("Segoe UI Semilight", 1, 14)); // NOI18N

jFormattedTextField1.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

jFormattedTextField1ActionPerformed(evt);

});

jLabel7.setBackground(new java.awt.Color(204, 51, 0));

jLabel7.setFont(new java.awt.Font("Segoe UI Semilight", 1, 14)); // NOI18N

jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel7.setText("Train No");

jLabel7.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));


36
jLabel7.setOpaque(true);

jTextField5.setFont(new java.awt.Font("Segoe UI Semilight", 1, 14)); // NOI18N

jTextField5.setHorizontalAlignment(javax.swing.JTextField.CENTER);

javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);

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(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 131,


Short.MAX_VALUE)

.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()

.addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 227,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 131,


javax.swing.GroupLayout.PREFERRED_SIZE)

.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)

.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 139,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 190,


javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(jPanel1Layout.createSequentialGroup()

.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 190,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(18, 18, 18)

.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 135,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 190,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 139,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(18, 18, 18)

.addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 190,


javax.swing.GroupLayout.PREFERRED_SIZE)))

.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)

.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 36,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 38,


Short.MAX_VALUE)

.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 36,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jFormattedTextField1, javax.swing.GroupLayout.PREFERRED_SIZE,
36, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 36,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jTextField2, 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)

.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 36,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 36,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 36,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 36,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 36,


javax.swing.GroupLayout.PREFERRED_SIZE)
39
.addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, 36,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(21, 21, 21))

);

jScrollPane1.setBackground(new java.awt.Color(153, 153, 153));

jScrollPane1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0,
0, 0), 4));

jTextArea1.setColumns(20);

jTextArea1.setFont(new java.awt.Font("Segoe UI Semilight", 1, 14)); // NOI18N

jTextArea1.setRows(5);

jScrollPane1.setViewportView(jTextArea1);

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());

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)

.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 293,


Short.MAX_VALUE)

.addContainerGap())

);

pack();

}// </editor-fold>

private void jFormattedTextField1ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

private void formWindowOpened(java.awt.event.WindowEvent evt) {

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");

private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {

42
// TODO add your handling code here:

/**

* @param args the command line arguments

*/

public static void main(String args[]) {

/* Set the Nimbus look and feel */

//<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.

* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html

*/

try {

for (javax.swing.UIManager.LookAndFeelInfo info :


javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Nimbus".equals(info.getName())) {

javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(ShowTicket.class.getName()).log(java.util.logging.Level.SEVER
E, null, ex);

} catch (InstantiationException ex) {

43
java.util.logging.Logger.getLogger(ShowTicket.class.getName()).log(java.util.logging.Level.SEVER
E, null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(ShowTicket.class.getName()).log(java.util.logging.Level.SEVER
E, null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(ShowTicket.class.getName()).log(java.util.logging.Level.SEVER
E, null, ex);

//</editor-fold>

/* Create and display the form */

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new ShowTicket().setVisible(true);

});

// Variables declaration - do not modify

private javax.swing.JFormattedTextField jFormattedTextField1;

private javax.swing.JLabel jLabel1;

private javax.swing.JLabel jLabel2;

private javax.swing.JLabel jLabel3;

private javax.swing.JLabel jLabel4;


44
private javax.swing.JLabel jLabel5;

private javax.swing.JLabel jLabel6;

private javax.swing.JLabel jLabel7;

private javax.swing.JPanel jPanel1;

private javax.swing.JScrollPane jScrollPane1;

private javax.swing.JTextArea jTextArea1;

private javax.swing.JTextField jTextField1;

private javax.swing.JTextField jTextField2;

private javax.swing.JTextField jTextField3;

private javax.swing.JTextField jTextField4;

private javax.swing.JTextField jTextField5;

// End of variables declaration

/////////////////////////////Supporting Classes////////////////////////////////

///////////////////////////////Connection Class///////////////////////////////

package railway;

import java.sql.Connection;

45
import java.sql.DriverManager;

import java.sql.SQLException;

public class connect {

public Connection dbConnect() throws ClassNotFoundException, SQLException

Connection conn = null;

String driver ="com.mysql.jdbc.Driver";

String url="jdbc:mysql://localhost:3306/start";

String uname="root";

String pa="";

Class.forName(driver);

conn=DriverManager.getConnection(url,uname,pa);

return conn;

/////////////////////// Login Verify Class //////////////////////////////////////

package railway;

import java.sql.Connection;

import java.sql.PreparedStatement;

46
import java.sql.ResultSet;

import java.sql.SQLException;

public class LoginVerify {

String user;

String pass1;

public String getValidated(String s1,char [] s2)

if(s1.equals(""))

return "empty username";

user=s1;

pass1=String.copyValueOf(s2);

if(pass1.equals(""))

return "empty password";

return "done";

public int getVerified() throws ClassNotFoundException, SQLException

connect ct=new connect();

Connection conn=ct.dbConnect();

System.out.println("check");

PreparedStatement pst=conn.prepareStatement("Select pass from login where


username=?");
47
pst.setString(1,user);

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;

/////////////////////////// Search Train ////////////////////////////////

package railway;

import java.sql.Connection;

import java.sql.PreparedStatement;

import java.sql.ResultSet;

import java.sql.SQLException;

/**

* @author acer pc

*/

public class SearchTrain {

Connection conn=null;

String from,to,tno,tname,arr,dept,arto,dur,day;

String []tra=new String[9];

49
public String[] getTrainInfo(String s1) throws ClassNotFoundException, SQLException{

connect ct=new connect();

conn=ct.dbConnect();

System.out.println("hello baby111");

PreparedStatement pst=conn.prepareStatement("Select * from railway where Train_No=?


");

pst.setString(1,s1);

System.out.println("hello babyp--pst");

ResultSet rs= pst.executeQuery();

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");

for( int i=0;i<9;i++)

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;

public class SearchRoute {

Connection conn=null;

String from,to,tno,tname,arr,dept,arto,dur,day;

//String []tra=new String[50];

public String[][] getTrainInfo(String s1,String s2) throws ClassNotFoundException,


SQLException{

connect ct=new connect();

conn=ct.dbConnect();

System.out.println("hello baby111");

PreparedStatement pst=conn.prepareStatement("Select * from trainlist where


FromStation=? And ToStation=?");

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;

Object []ar=new Object[5];

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;

String [][]ar=new String[5][5];

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;

////////////////////////////// Availablity /////////////////////////////////

package railway;

import java.sql.Connection;

import java.sql.Date;

import java.sql.PreparedStatement;

import java.sql.ResultSet;

import java.sql.SQLException;

public class Availabilty {

Connection conn=null;

String from,to,tno,tname,arr,dept,arto,dur,day;

Integer []tra=new Integer[6];

55
public Integer[] getTrainInfo(int s1,String d) throws ClassNotFoundException, SQLException{

connect ct=new connect();

conn=ct.dbConnect();

System.out.println("hello baby111");

PreparedStatement pst=conn.prepareStatement("Select * from avail where Train_No=? and


Date=?");

pst.setInt(1,s1);

pst.setString(2,d);

System.out.println("hello babyp--pst");

ResultSet rs= pst.executeQuery();

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");

for( int i=0;i<6;i++)

System.out.println(tra[i]);

return tra;

57
}

/////////////////////////// Final Booking /////////////////////////////////////

package railway;

import java.sql.Connection;

import java.sql.Date;

import java.sql.PreparedStatement;

import java.sql.ResultSet;

import java.sql.SQLException;

public class FinalBooking {

Connection conn=null;

String pnr;

String []n1=new String[5];

String []sex=new String[5];

String []pref=new String[5];

Integer [] age =new Integer[5];

String []cat=new String[5];

String pan,id_no,chseat,date2,tno;

58
int cnt;

int mob;

public String getConnect(String pnr) throws ClassNotFoundException, SQLException

this.pnr=pnr;

connect ct=new connect();

conn=ct.dbConnect();

System.out.println("hello baby111");

String query="CREATE TABLE start."+ pnr + "(name varchar(255),age int(22),sex


varchar(30),preference varchar(30),category varchar(30),mobile int(30),id_type
varchar(30),id_no varchar(255))";

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)

System.out.println("table is not created");

else{

System.out.println("table is created");

59
}

return pnr;

@SuppressWarnings("ConvertToStringSwitch")

public void insertDetails(String pnr,String [] name,Integer [] age1,String [] sex1,String []


pref1,String [] cat1,int mob1,String pan1,String id_no1,int cnt1,String seat,String date1,String
tno1) throws ClassNotFoundException, SQLException

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);

connect ct=new connect();

conn=ct.dbConnect();

System.out.println("hello baby111");

String query="insert into " + pnr + "


(name,age,sex,preference,category,mobile,id_type,id_no) values(?,?,?,?,?,?,?,?)";

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");

System.out.println("seat is " + ch);

ResultSet rs1=pst1.executeQuery();

while(rs1.next())

seatvar=rs1.getInt(ch);

System.out.println("total seat in "+ ch + " is "+seatvar);

if(chseat.equals("SL"))

seatvar=seatvar-cnt;

query2="UPDATE avail SET Sleeper="+seatvar+ " WHERE Train_No=? AND Date=?";

System.out.println(query2);

ch="Sleeper";

else if(chseat.equals("3AC"))

seatvar=seatvar-cnt;

query2="UPDATE avail SET 3AC="+seatvar+ " WHERE Train_No=? AND Date=?";

System.out.println(query2);

ch="3AC";
63
}

else if(chseat.equals("2AC"))

seatvar=seatvar-cnt;

query2="UPDATE avail SET 2AC="+seatvar+ " WHERE Train_No=? AND Date=?";

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";

System.out.println("IN updatio0n area");

conn=ct.dbConnect();

PreparedStatement pst2=conn.prepareStatement(query2);

pst2.setInt(1,tno2);

pst2.setDate(2,date);

System.out.println("3.2 erro0r free area");

int b=0;

b=pst2.executeUpdate();

System.out.println("3.2 erro0r free area");

if(b>0)

64
{

System.out.println("ticket successfull updated");

else{

System.out.println("ticket n0t successfull updated");

else{

System.out.println("ticket not successfull");

65
66

Anda mungkin juga menyukai