Anda di halaman 1dari 28


In-House Training Project

Reservation System Using JAVA

Submitted to



Ms. Smriti Sehgal Dishank Saxena
5CSE-6 (X)



I DishankSaxena student of B.Tech (CSE) hereby declare that the project titled
RESERVATION SYSTEM USING JAVA a JAVA Application which is submitted by
me to The Department of CSE , Amity School of Engineering and Technology , Amity
University Uttar Pradesh , Noida, in partial fulfillment of requirement of award of the degree
of Bachelor of Technology in CSE, has not been previously formed the basis for the award of
any degree, diploma or other similar title or recognition.




I feel very greatfull to thank all the people who have helped me and supported me in
completing my In-House Project.
My deepest thanks to my faculty, Ms. Smriti Sehgal, the mentor of the project, for guiding
and correcting me with attention and care. I greatly appreciate the efforts she took to go
through my data and make necessary corrections as and when needed.
I also express my thanks to Dr. Abhay Bansal, The Head Of Department (HOD), and Mr.
Praveen Kumar, The Program leader (PL), for extending their support.
Words are inadequate in offering my thanks to the various helpful people of Amity University
for their encouragement and cooperation in carrying out the project work.
I would also thank my Institution and my faculty members without whom this project would
have been a distant reality.
Finally, yet importantly, I would like to express my heartfelt thanks to my beloved parents for
their blessings, my friends/classmates for their help and wishes for the successful completion
of this project.

Dishank Saxena



This is to certify that Mr.Dishank Saxena, student of B. Tech. in CSE has carried out the work
presented in the project of the Practical Training-I entitled Reservation System Using
JAVA as a part of Second year program of Bachelor of Technology in CSE from Amity
School of Engineering and Technology, Amity University, Noida, Uttar Pradesh under my

Ms. Smrit Sehgal
ASET Noida, U.P.


Table Of Contents
2.3 C# LANGUAGE16-17



The purpose of this project is enhance and make the reservation system more advanced for the
users. This project helps in removing all the unsatisfied features and helps in making them
more efficient and advanced. The project also highlights the various softwares and tools used
for the reservation system.

The JAVA application has a very simple and user friendly GUI making user experience
easier, and runs on a executable .JAR file.

Since The reservation system is handled by a website i.e it is a very heavy
website. And when multiple users are logged in then the server is unable to take the load , due
to which the users cannot access different pages and are unable to reserver their tickets on
time. It has some missing features which are added in my JAVA application.

Though IRCTC has evolved with newer versions in the past but still it is not able to give
proper facility of reservation for users. My JAVA application contains no lag when multiple
users are logged in and it also contains newly added features that includes saving the journey
to Favourites for future access , saving the payment card for Quick Payment in future



Java is a computer programming language that is concurrent, class-based, object-oriented,

and specifically designed to have as few implementation dependencies as possible. It is

intended to let application developers "write once, run anywhere" (WORA), meaning that

code that runs on one platform does not need to be recompiled to run on another. A JAVA

application has been made with the help of the tool Netbeans 7.4. Java applications are

typically compiled to byte code that can run on any Java virtual machine (JVM). The JAVA

based applications are basically designed on a platform called Netbeans. This tool is provides

Very advanced interface for the programmer to create code and GUI for the software. The

basic preview of the code is also available for userss convenience. JAVA Application

development is very useful for making various kinds of Applications . Netbeans has all the

basic and the advanced tool for creating a JAVA based application. It has an auto guide option

which automatically guides u about how to remove the errors appearing in the code. And

also helps in debugging those errors. JAVA applications helps in interacting with the user and

making the work easier and convenient. JAVA also provides connection to DATABASE and

syncing the software with the SQL database for storing and retrieving records of different

users. Connection to database greatly helps in creating and full fledged and efficient Java


About JAVA

Java is a set of several computer software products and specifications from Oracle
Corporation that provides a system for developing application software and deploying it in
a cross-platform computing environment. Java is used in a wide variety of computing
platforms from embedded devices and mobile phones on the low end, to enterprise
servers and supercomputers on the high end. While less common, Java applets are sometimes
used to provide improved and secure functions while browsing the World Wide
Web on desktop computers.
There are, however, bytecode compilers available for other languages such
as Ada, JavaScript, Python, and Ruby. Several new languages have been designed to run
natively on the Java Virtual Machine (JVM), such as Scala, Clojure and Groovy. Java
syntax borrows heavily from C and C++, but object-oriented features are modeled
after Smalltalk and Objective-C. Java eliminates certain low-level constructs such
as pointers and has a very simple memory model where every object is allocated on the
heap and all variables of object types are references. Memory management is handled through
integrated automatic garbage collection performed by the JVM


Java Virtual Machine

The heart of the Java platform is the concept of a "virtual machine" that executes Java
bytecode programs. This bytecode is the same no matter what hardware or operating system
the program is running under. There is a JIT (Just In Time) compiler within the Java Virtual
Machine, or JVM. The JIT compiler translates the Java bytecode into native processor
instructions at run-time and caches the native code in memory during execution.

The use of bytecode as an intermediate language permits Java programs to run on any
platform that has a virtual machine available. The use of a JIT compiler means that Java
applications, after a short delay during loading and once they have "warmed up" by being all
or mostly JIT-compiled, tend to run about as fast as native programs.Since JRE version 1.2,
Sun's JVM implementation has included a just-in-time compiler instead of an interpreter.

Although Java programs are cross-platform or platform independent, the code of the Java
Virtual Machines (JVM) that execute these programs is not. Every supported operating
platform has its own JVM.


JAVA Swing Application

Swing is a graphical user interface library for the Java SE platform. It is possible to
specify a different look and feel through the pluggable look and feel system of Swing. Clones
of Windows, GTK+ and Motif are supplied by Sun. Apple also provides an Aqua look and
feel for Mac OS X. Where prior implementations of these looks and feels may have been
considered lacking, Swing in Java SE 6 addresses this problem by using more native GUI
widget drawing routines of the underlying platforms.

This example Swing application creates a single window with "Hello, world!" inside:

import javax.swing.*;

public class Hello extends JFrame {
public Hello() {
super.add(new JLabel("Hello, world!"));

public static void main(final String[] args) {
new Hello();
The first import includes all of the public classes and interfaces from
the javax.swing package.
The Hello class extends the JFrame class; the JFrame class implements a window with
a title bar and a close control.


The Hello() constructor initializes the frame by first calling the superclass constructor,
passing the parameter "hello", which is used as the window's title. It then calls
the setDefaultCloseOperation(int) method inherited from JFrame to set the default
operation when the close control on the title bar is selected to
WindowConstants.EXIT_ON_CLOSE this causes the JFrame to be disposed of when
the frame is closed (as opposed to merely hidden), which allows the Java virtual machine to
exit and the program to terminate. Next, a JLabel is created for the string "Hello,
world!" and the add(Component) method inherited from the Containersuperclass is called to
add the label to the frame. The pack() method inherited from the Window superclass is called
to size the window and lay out its contents.

The main() method is called by the Java virtual machine when the program starts.
It instantiates a new Hello frame and causes it to be displayed by calling
the setVisible(boolean) method inherited from the Component superclass with the boolean
parameter true. Once the frame is displayed, exiting the main method does not cause the
program to terminate because the AWT event dispatching thread remains active until all of
the Swing top-level windows have been disposed.


JAVA Applet

Java applets are programs that are embedded in other applications, typically in a Web
page displayed in a Web browser.

import javax.swing.JApplet;
import java.awt.Graphics;

public class Hello extends JApplet {
public void paintComponent(final Graphics g) {
g.drawString("Hello, world!", 65, 95);
The import statements direct the Java compiler to include
the javax.swing.JApplet and java.awt.Graphics classes in the compilation. The import
statement allows these classes to be referenced in the source code using the simple class
name (i.e. JApplet) instead of the fully qualified class name (FQCN,
i.e. javax.swing.JApplet).

The Hello class extends (subclasses) the JApplet (Java Applet) class; the JApplet class
provides the framework for the host application to display and control the lifecycle of the
applet. The JApplet class is a JComponent (Java Graphical Component) which provides the
applet with the capability to display a graphical user interface (GUI) and respond to
user events.

The Hello class overrides the paintComponent(Graphics) method (additionally
indicated with the annotation, supported as of JDK 1.5, Override) inherited from
the Container superclass to provide the code to display the applet.
The paintComponent() method is passed a Graphics object that contains the graphic context
used to display the applet. The paintComponent() method calls the graphic
context drawString(String, int, int) method to display the "Hello, world!" string at
a pixel offset of (65, 95) from the upper-left corner in the applet's display.


<!-- Hello.html -->
<title>Hello World Applet</title>
<applet code="Hello.class" width="200" height="200">

An applet is placed in an HTML document using the <applet> HTML element.
The applet tag has three attributes set: code="Hello" specifies the name of the JApplet class
and width="200" height="200" sets the pixel width and height of the applet. Applets may
also be embedded in HTML using either the object or embed element, although support for
these elements by Web browsers is inconsistent. However, the applet tag is deprecated, so
the object tag is preferred where supported.


Reservation System

The Indian reservation system has a special online ticketing website for booking and
cancellation of the railway train tickets. The Indian Railway Catering and Tourism
Corporation provides the facility of online reservation system.

Basic UI of IRCTC

The web app of IRCTC contains a user login with registered credentials. The login page saved
cookies for only few seconds thus this website takes a lot of time to load fully. Then The
Home page asks for the source and the destination details of the train . When you click on
Find Trains the loader retrieves the list of trains for particular destination. But this feature
takes a lot of time to load.

Rervation System Using JAVA

I have focused on all the missing features and all the slow working features of irctc and
updated those features in my software. My JAVA application contains all the missing features
of irctc and is very efficient . It takes very less time to login and display HOME page. It has a
feature which saves the favourite journey spot details which can be easily accessed in future
via Favourites tab. My project is designed on the tool called NETBEANS.


NetBeans is an integrated development environment (IDE) for developing primarily
with Java, but also with other languages, in particular PHP, C/C++, and HTML5. It is also
an application platform framework for Java desktop applications and others.

The NetBeans IDE is written in Java and can run on Windows, OS X, Linux, Solaris and
other platforms supporting a compatible JVM.

The NetBeans Platform allows applications to be developed from a set of modular software
components called modules. Applications based on the NetBeans Platform (including the
NetBeans IDE itself) can be extended by third party developers.

The NetBeans Team actively support the product and seek future suggestions from the wider
community. Every release is preceded by a time for Community testing and feedback

NetBeans IDE is an open-source integrated development environment. NetBeans IDE
supports development of all Java application types (Java SE (including JavaFX), Java
ME, web, EJB and mobile applications) out of the box. Among other features are an Ant-
based project system, Maven support, refactorings, version
control (supporting CVS, Subversion, Git, Mercurial and Clearcase).

Modularity: All the functions of the IDE are provided by modules. Each module
provides a well defined function, such as support for theJava language, editing, or support for
the CVS versioning system, and SVN. NetBeans contains all the modules needed for Java
development in a single download, allowing the user to start working immediately. Modules
also allow NetBeans to be extended. New features, such as support for other programming
languages, can be added by installing additional modules. For instance, Sun Studio, Sun Java
Studio Enterprise, and Sun Java Studio Creator from Sun Microsystems are all based on the
NetBeans IDE.


License: From July 2006 through 2007, NetBeans IDE was licensed under
Sun's Common Development and Distribution License (CDDL), a license based on
the Mozilla Public License (MPL). In October 2007, Sun announced that NetBeans would
henceforth be offered under a dual license of the CDDL and the GPL version 2 licenses, with
the GPL linking exception for GNU Classpath.

Localization (Netbeans)

NetBeans IDE is translated into the following languages:

Brazilian Portuguese (BR), as of 5.5

Japanese (JP), as of 3.4

Simplified Chinese (ZH)


Community translations of the IDE are also available in the following languages:

Community translations

Language Platform
Java SE
German As of 5.5
As of 5.5
Greek As of 6.9 No No
Hindi As of 6.9 No No
Lithuanian As of 6.9 No No
Romanian As of 6.8 No No
Russian As of 5.0
As of 5.0
As of 6.9.1
Serbian As of 6.9 No No
Spanish As of 5.5
As of 5.5
Swedish Yes Yes No


Key Benefits of Java

Why use Java at all? Is it worth learning a new language and a new platform? This
section explores some of the key benefits of Java.

1. Write Once, Run Anywhere

Sun identifies "Write once, run anywhere" as the core value proposition of the Java
platform. Translated from business jargon, this means that the most important promise of Java
technology is that you only have to write your application once--for the Java platform--and
then you'll be able to run it anywhere.

Anywhere, that is, that supports the Java platform. Fortunately, Java support is becoming
ubiquitous. It is integrated, or being integrated, into practically all major operating systems. It
is built into the popular web browsers, which places it on virtually every Internet-connected
PC in the world. It is even being built into consumer electronic devices, such as television set-
top boxes, PDAs, and cell phones

Another key benefit of Java is its security features. Both the language and the platform
were designed from the ground up with security in mind. The Java platform allows users to
download untrusted code over a network and run it in a secure environment in which it cannot
do any harm: it cannot infect the host system with a virus, cannot read or write files from the
hard drive, and so forth. This capability alone makes the Java platform unique.

The Java 2 Platform takes the security model a step further. It makes security levels and
restrictions highly configurable and extends them beyond applets. As of Java 1.2, any Java
code, whether it is an applet, a servlet, a JavaBeans component, or a complete Java
application, can be run with restricted permissions that prevent it from doing harm to the host

The security features of the Java language and platform have been subjected to intense
scrutiny by security experts around the world. Security-related bugs, some of them potentially
serious, have been found and promptly fixed. Because of the security promises Java makes, it
is big news when a new security bug is found. Remember, however, that no other mainstream
platform can make security guarantees nearly as strong as those Java makes. If Java's security

is not yet perfect, it has been proven strong enough for practical day-to-day use and is
certainly better than any of the alternatives.

3. Network-centric Programming

Sun's corporate motto has always been "The network is the computer." The designers of
the Java platform believed in the importance of networking and designed the Java platform to
be network-centric. From a programmer's point of view, Java makes it unbelievably easy to
work with resources across a network and to create network-based applications using
client/server or multitier architectures. This means that Java programmers have a serious head
start in the emerging network economy.

4. Dynamic, Extensible Programs

Java is both dynamic and extensible. Java code is organized in modular object-oriented
units called classes. Classes are stored in separate files and are loaded into the Java interpreter
only when needed. This means that an application can decide as it is running what classes it
needs and can load them when it needs them. It also means that a program can dynamically
extend itself by loading the classes it needs to expand its functionality.

The network-centric design of the Java platform means that a Java application can
dynamically extend itself by loading new classes over a network. An application that takes
advantage of these features ceases to be a monolithic block of code. Instead, it becomes an
interacting collection of independent software components. Thus, Java enables a powerful
new metaphor of application design and development.

5. Internationalization
The Java language and the Java platform were designed from the start with the rest of the
world in mind. Java is the only commonly used programming language that has
internationalization features at its very core, rather than tacked on as an afterthought. While
most programming languages use 8-bit characters that represent only the alphabets of English
and Western European languages, Java uses 16-bit Unicode characters that represent the
phonetic alphabets and ideographic character sets of the entire world. Java's
internationalization features are not restricted to just low-level character representation,
however. The features permeate the Java platform, making it easier to write internationalized
programs with Java than it is with any other environment.


6. Performance
As I described earlier, Java programs are compiled to a portable intermediate form known
as byte codes, rather than to native machine-language instructions. The Java Virtual Machine
runs a Java program by interpreting these portable byte-code instructions. This architecture
means that Java programs are faster than programs or scripts written in purely interpreted
languages, but they are typically slower than C and C++ programs compiled to native
machine language. Keep in mind, however, that although Java programs are compiled to byte
code, not all of the Java platform is implemented with interpreted byte codes. For efficiency,
computationally intensive portions of the Java platform--such as the string-manipulation
methods--are implemented using native machine code.

Although early releases of Java suffered from performance problems, the speed of the
Java VM has improved dramatically with each new release. The VM has been highly tuned
and optimized in many significant ways. Furthermore, many implementations include a just-
in-time compiler, which converts Java byte codes to native machine instructions on the fly.
Using sophisticated JIT compilers, Java programs can execute at speeds comparable to the
speeds of native C and C++ applications.

Java is a portable, interpreted language; Java programs run almost as fast as native, non-
portable C and C++ programs. Performance used to be an issue that made some programmers
avoid using Java. Now, with the improvements made in Java 1.2, performance issues should
no longer keep anyone away. In fact, the winning combination of performance plus portability
is a unique feature no other language can offer.

7. Programmer Efficiency and Time-to-Market
The final, and perhaps most important, reason to use Java is that programmers like it.
Java is an elegant language combined with a powerful and well-designed set of APIs.
Programmers enjoy programming in Java and are usually amazed at how quickly they can get
results with it. Studies have consistently shown that switching to Java increases programmer
efficiency. Because Java is a simple and elegant language with a well-designed, intuitive set
of APIs, programmers write better code with fewer bugs than for other platforms, again
reducing development time.


Reservation System Using JAVA

I have created this JAVA application on Netbeans. My Applications contains various classes
such as , , , , , etc.

The Login.JAVA -:

Fig 1 Login.JAVA

The Class Login.JAVA -:

1-: It is Connected to DATABSE For storing User Details.

2-: It stores the information of new user and provides a unique username and its account

3-: The Username Field is Name and the Password field contains the password. Saved and
synced for the DATABASE.

4-: After entering the provided username and password the user presses the SUBMIT

5-: The Submit Button checks on backhand that whether the correct combination of username
and password has been typed or not.

6-: If the login credentials are correct the user is directed to the HOME page.

7-: If the login details of the user are incorrect then Warning message appears.

8-: The incorrect details entered user gets 3 more chances to think and enter the correct
details. If not able to then the Login Page will be disposed off.

9-: This feature will remove load for the login page and provide other users to free and
smooth access of the software.


The Home.JAVA

The Class Home.JAVA-:

1-: This page appears when the user enters the correct login details for his account.

2-: This page contains all the necessary features such a train between stations.

3-: It provides a facility to check the PNR status for already booked tickets.

4-: The user enters the desired Source and Destination Station where he would like to travel.

5-: The page displays the Date and Availability details for that particular train.

6-: The Add To Favourites Checkbox provides a new feature to remember and save this
journey for future reference.

7-: The details and the availability and other details such as Train Name , Train Number etc
are available.

8-: The user can book ticket by clicking on Book Now and reserve his ticket by seeing the
availability for the next six days.

9-: This Page also has the Drop Down Menu feature to access other features at one point.

(Click Arrow Button below to let menu items appear)


The Class Booking.JAVA

The Class Booking.JAVA

1- : The class Booking,JAVA appears when the user has entered the Source and
Destination details and clicked on Book Now For particular train ticket.

2-: This Page contains and prompts for details for all the passengers to be travelling.

3-: Helps in choosing proper berth and class of the train.

4-: Has got a Email ID feature which will send the booked ticket to their respective
Email ID.

5-: Helps in entering and booking the ticket for 6 people at 1 Go.After the
BOOKING.JAVA page the Payment Gateway page appears and which asks for the
users card that includesDebit / Credit card details.After entering the details the page is
redirected to the respective bank payment gateway merchandise.

Feature of Project and its Advantages

Provides easy registration for the users

Provides easy access to all pages.

Provides add to favourite option for users.

Provides Saving Card For Future payment transactions.

Future of the Application

The future of my application seems very bright.

I will try implementing some new features to it as I enhance my knowledge in this

I will also try adding more supportive pages to my application

I am currently studying how to implement more database features add some more
basic features to my application.

When completed, my application could get a good feedback by the users as it is more
efficient than irctc.



Online Pages-

1. C# 4.0 The Complete Reference by Herbert Schildt
2. Beginning Windows 8 Application Development XAML edition by Kyle Burns