0% found this document useful (0 votes)
1K views

Android Online Local Train Reservation

The document describes an Android mobile application for online local train reservation. The proposed system allows passengers to book and cancel reservations online through mobile forms without having to wait in lines. It includes modules for login, reservation, cancellation, PNR enquiry, and exit. The system saves data to a central database for access by authorized users. It aims to make the reservation process easier for customers compared to the existing manual system. The system requirements include Android OS, Java programming language, and an Oracle database.

Uploaded by

Harsha Reddy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views

Android Online Local Train Reservation

The document describes an Android mobile application for online local train reservation. The proposed system allows passengers to book and cancel reservations online through mobile forms without having to wait in lines. It includes modules for login, reservation, cancellation, PNR enquiry, and exit. The system saves data to a central database for access by authorized users. It aims to make the reservation process easier for customers compared to the existing manual system. The system requirements include Android OS, Java programming language, and an Oracle database.

Uploaded by

Harsha Reddy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 57

Android Online Local Train Reservation

Objective:-
Through this system, a practical approach has been taken under study to understand how Android Online
Local Train Reservation system works. This system will include all the necessary fields which are required
during online reservation system. This system will be easy to use and can be used by any person. The basic
idea behind this project is to save data in a central database which can be accessed by any authorize
person to get information and saves time and burden which are being faced by their customers.

Existing System:-
Even though the online reservation system is available but the passengers have to fill all their necessary
details using pen and paper which involves manual working. It’s the main counter is not open due to late
arrival or due to some reasons then in this case, passengers have to wait and in certain cases they have to
wait in line, waiting for their chance to come. After wasting so much time, customers able to get their
answers and sometimes they did not positive response.

Proposed System:-
Through this system customers do not have to wait in line and they will able to get their answers in just a
click. Through this system online form will be available by which passengers will able to fill their details
along with their journey details. To book their seats, users will have to first search their trains as per their
requirements and after getting correct train they will have to provide Train number. After pressing next
button, it will show its status, whether it has been activated or in process. Online cancellation form will
also be available and to cancel their reservation, they will have to provide their PNR number again to carry
the next task.

Number of Modules:-
1. Login Form.
2. Reservation Form.
3. Cancellation Form.
4. PNR Enquiry.
5. Exit.
Description of Modules:-
Login Form –To access this system, each user should have a valid login id and password. After providing
the correct login id and password, users will able to access the main system.

Reservation System –Under reservation form users will have to fill the necessary details such as their
basic details, train number, train name will automatically come in the box, class type, date of journey, from
(place) to destination and after that, users will have to press insert button.

Cancellation Form –If passengers want to cancel their tickets then they have to provide their PNR
number and after submitting it, this will display the entire information related to that particular PNR
number. If users want to confirm their cancellation, in this case they have to press OK button .

Software Requirements:
1. Operating System : Windows XP/2003 or Higher Version of Windows OS.
2. User Interface : Java Swing.
3. Programming Language : Java.
4. Database : Oracle

Hardware Requirements:
7. Processor : Pentium IV or above.
8. Hard Disk : 50GB
9. RAM : 512 MB or more
Table of content
1. Introduction
1.1 Purpose
1.2 Document Conventions
1.3 Intended Audience
and Reading
Suggestions
1.4 Definitions, Acronyms and
Abbreviations
1.5 Scope

2.Overall description
2.1 Product Perspective
2.2 Product Function
2.3 Guest Interface
2.4 Train Management Interface
2.5 Operating Environment
2.6 Memory Constrains
2.7 Operations
2.8 User Interface
2.9 Hardware Interface
2.10Software Interfaces
2.11Assumptions, Dependencies
&Limitations

3.System Features
3.1 Description &Priority
3.2 Functional Requirements
3.1.1 View Train Details
3.1.2 Search Train
3.1.3 Create Account
3.1.4 Customer Login
3.1.5 Purchase Ticket
3.1.6 Purchase History
3.1.7 Login Function
3.1.8 Staff Module
3.1.9 Reservation Module
3.1.10 Ticket Module
3.1.11 Membership
Module
3.1.12 Train Module
3.1.13 Pricing Module
3.1.14 Availability Module
3.1.15 Branch Module
3.1.16 Report Module
3.1.17 Access Type

4. External Interface Requirements


4.1 User Interface
4.2 Hardware Interfaces
4.3 Software Interfaces
4.4 Communication Interface

5.Non-functional Requirements
5.1 Performance Requirements
5.2 Safety Requirements
5.3 Security Requirements
5.4 Design Constraint
1. INTRODUCTION

1.1 PURPOSE
The purpose of this source is to describe the railway reservation system which provides the train
timing details, reservation, billing, cancelation on various types of reservation namely.
 Confirm Reservation for confirm Seat.
 Reservation against Cancellation
 Waiting list Reservation.
 Online Reservation.
 Tatkal Reservation

1.2 DOCUMENTCONVENTIONS:

 Main heading: Bold


 Not applicable

1.3 INTENDED AUDIENCE AND READINGSUGGESTIONS:


The different types of readers are
 customer
 Developers
 Management
 Passengers
 Counter clerk

1.4 DEFINATIONS, ACRONYMS AND ABBREVIATIONS

 NTES- National Train Enquiry System


 IVRS-Interactive Voice Response System
 PRS-Passenger Reservation System
consist of
Train details
Reservation form
Billing
Cancellation
1.5 SCOPE

 Freight Revenue enhancement.


 Passenger Revenue enhancement.
 Improved & optimized service.
This project designs and implements RRS to fulfill all the vision statements. Supported by a
well-designed database, all available air train information is integrated together and can be
accessed easily through a single point. A friendly user interface is provided so that various
combinations of search criteria can be fetched from user and generates corresponding database
search statements. RRS provided both customer and administration interfaces with the latter
used for administration purposes. If time permits, RRS will support frequent user registration
and personal information management.
2. OVERALLDESCRIPION

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

2.2 PRODUCTFUNCTIONS:
OMBS will have two users interface layers, first one is guest interface and the second
one is Train Management Interface.

2.3 GUESTINTERFACE:
 View Train Details

 Search Train
 Create Account
 Customer Login
 Purchase Ticket
 Purchase History

2.4 TRAIN MANAGEMENTINTERFACE:


 Login Function
 Staff Module
 reservation Module
 Ticket Module
 Membership Module
 Train Module
 Pricing Module
 Availability Module
 Branch Module
 report module
 Access Type

2.5 OPERATINGENVIRONMENT
 OS
 Windows NT
 Linux
 Windows XP
 Windows 98

2.6 MEMORYCONSTRAINTS
A maximum of 42 laces hits per day have been recorded.

2.7 OPERATIONS:

 Any reservation counter from 8 am to 8pm.


 Prior to 60 days of journey.
 One form for 6 persons only.
 Reserved ticket done through pre-defined Logic.
 To save time and queues agents is others guides.

2.8 User Interfaces


The system shall provide a help (explanation) link from each displayed HTML page to
explain how to use that page.
The Web page of RRS shall permit complete navigation, train selection, ticket reservation
and ticket/train information query view using keyboard and mouse combinations.

2.9 Hardware Interfaces


No hardware interface specified for RRS.

2.10 Software Interfaces


Train/ticket inventory/database system:
(1) The RRS should transmit and store the detailed properties (quantities, train number,
departure/return time/date, seat, location) of ticket items for the potential requests
from users.
(2) The Train/ticket inventory/database system should keep updated information about the
availability of ticket and train information to determine whether a requested reservation is
available or not.
(3) When the RRS make the query about ticket information with constrains, Train/ticket
inventory/database system should provide all the information that satisfy thequery.
(4) The Train/ticket inventory/database system should accept information update
operation flows
Coming from the administrator interface system.

User query/view system:


The user query/view system should communicate with Train/ticket inventory/database
system through a programming interface for the following operations.

(1) To allow a user post various query about ticket information available at present. User can
use any combination available
(2) To show the user the resulting list of query. This should allow users to further sort the list by
subfields of the ticket information (e.g. price). The view should be friendly and flexible.
(3) To allow a user place a reservation
(4) To detect the conflict if a user placed two incompatible reservations.
(5) To allow a user view his/her reservation
(6) To allow user modify his/her reservation
(7) To allow user to manage his/her account in RRS
2.11 ASSUMPTIONS,DEPENDENCIES ANDLIMITATIONS
AS-1: Users of RRS are assumed to have a computer with internet access.
AS-2: Credit and debit card authorization services are assumed to be
available.
DE-1: RRS has collaboration with every airline’s databases thus it must be able to communicate
with these systems. Also it has to obey airline’s business rules.
3. SYSTEMFEATURES

3.1 DESCRIPTION ANDPRIORITY


The search feature allows the user to search for arrival line train on a variety of dimensions.

3.2 FUNCTIONALREQUIREMENTS

Required # Description Priority

The user will be able to search for trains through


standardized screen. Advanced options will be
REQ-S1 [Priority = High]
available by clicking appropriate links.

Through the standard trains search method the user will


be able to search one-way, round-trip, or multi-
REQ-S2 destination trains. The screen by default will display [Priority = Medium]
option searching round trip trains. The search criteria
can be modified by the user by selecting one-way and
multi-destination options which would be displayed on
a new window.

Through the standard trains search method the user


shall be able to specify the departure and return
REQ-S3 date of their trains. [Priority = High]

Through an advanced train search method the user


shall be able to specify the arrival train times.
REQ-S4 [Priority = Medium]

The standard train search method will enable the user


To search both precise dates as well as a range of
REQ-S5 arrival and departure dates. [Priority = Medium]

REQ-S6 The standard train search method will allow the user to [Priority = Low]
specify a preferred rail line. This is optional, i.e. the
user may or may not specify the rail line of preference.

REQ-S7 The user will have the option to express a preference of [Priority = Low]
non-stop train; otherwise both non-stop trains and
trains with stopovers will be treated equally.
REQ-S8 User can only search for a train in the future and within [Priority = High]
one year of the current date. (The cutoff time can be
applied, i.e. user cannot make the reservation for the
train which will take off in 2 hours.)

REQ-S9 The user to select any hour on the hour (i.e. trains at [Priority = High]
12am, 11am, 2pm etc.).
REQ-S10 When the user is searching for a train he may select [Priority = Medium]
one of the following preset time ranges: Morning,
Evening, Night, or Anytime.
REQ-S11 User should be able to search by Train number and rail [Priority = Low]
line. This will allow him to see the particular train for
the particular rail line.
REQ-S12 The user may specify anywhere from 1 (one) to 6 [Priority = High]
(six)passengers. Passengers will not be treated
separately as minors or seniors.
REQ-S13 Any error in entry of the system will stop the system [Priority = High]
from processing the search. An error message will be
presented to the user.

GUEST INTERFACE:
 View Train Details
The system shall enable customer or visitor to view list of trains.
 Search Train
The system shall have search function. Customer can search train based on source and
destination station details with date and time.
 Create Account
The system shall function to create an account. The system shall record all the
following data from the customer.
a. Username
b. Password
c. Password confirmation
d. First name
e. Last name
f. Identify card number
g. Address
h. Zip code
i. City
j. State
k. Country
l. Mobile no.
 Customer Login

The system shall have customer login functions, once activated, customer can login using
username and password.
The system shall have username and password recovery function.
 Purchase Ticket

The system shall enable customer to purchase the train ticket from guest
interface. The system shall display all the train details.
The system shall display the date time and price of the ticket.
The system shall have book now button. When book now button is pressed, the
system shall prompt customer to login or register account.
The system shall allow customer who have login only to continue to purchase ticket. If
customer haven’t login, prompt customer to login and create account.
 Purchase History
The customer can watch all the purchase history from this module.

TRAIN MANAGEMENT INTERFACE:


 Login Function
The system should allow only staff username and password to access
the system. Access to the module determined by account type and
branch office Location.
 Staff Module

The system shall allow system administration only to access the module. System
administration shall login first to access this module.
The system shall allow the system administration to add staff, update staff and delete
staff. The system shall record all the following details:
a. Staff Username
b. password
c. Account
d. First Name
e. Last Name
f. Address
g. City
h. State
 Reservation Module

The system shall allow counter clerk, station manager and station supervisor of the particular
station to access this module. They should login first.
The system shall limit the access to branch level only.
The system shall display the seating arrangements for customers. The system shall display the
total amount of ticket. The system shall allow station manager or clerk to check the details.

 Ticket Module


Ticket booking:
The Ticket Booking is user (Employee of Railway Dept.) side module. The user can book
the ticket using this module. The user should follow the steps for the ticket booking.
First you should select the Source and Destination.
Next, you should select the Date. While the date textbox got focus, the calendar will display.
By clicking the calendar, the date will be selected. And you can’t select the yesterday and
before date.
a) Select the Quota (General or Tatkaal).
b) Click the Find button to find the trains which are available.
Note:
If you select the Tatkaal Quota and the date is day after tomorrow in the sense, you can’t book
the ticket for Tatkaal Quota for that day. The Tatkaal Quota will enable only today and tomorrow
only.
e) After clicking the find button, the available train list will be displayed in the flex grid.
f) By clicking the train number or train name in the flex grid, the “Route” button enabled.
By clicking the route button, the corresponding train route, timings, and kms.
g) By clicking the class column to the corresponding train whichever you want to travel,
then “Book” button will enable.
h) Click the “Book” button to enter the Name, Age, Sex and Berth.
i) After Enter the details, Click the Proceed Button.
j) The frame will display the overall details like Source, Destination, Travel Date, Booked Date,
Total Members, Quota and Total Fare.
k) Click the “Confirm” Button to confirm the details. Then only the Booking details will be
stored and PNR Number will be generated

Ticket cancellation:

The Ticket Canceling is also user (Employee of Railway Dept.) side module. The user can
cancel the ticket using this module. The user should follow the steps for the ticket Cancel.
a) Enter the PNR Number in the Textbox and Click Find.
b) It will show the details like Train No., Train Name, Booked Date, Travel Date, Source,
Destination, Class, Quota, Total Fare, Kms in the Frame.
c) It also shows the passenger names, Age, Sex, Berth, Class, Fare and status in the flex grid.
d) Click the Name in the flex grid which you want to cancel and where the status is “Booked”.
e) Click the “Cancel” Button to cancel the ticket.

 Membership Module


The system shall allow station master and branch manager and branch supervisor of the
particular station to access this module.
The system shall record the following data for the customer:
a. first name
b. last name
c. address
d. city
e. state
f. country

 Train Module


The system shall allow head office personnel only to add and update new train timing details
in the system. Head office Personnel shall login first to access this module.
The system shall record the following details of each train
g. Train Name
b. Train timings
c. Train description, duration on each station
d. Train stations

 Pricing Module


The system shall allow branch manager and branch supervisor of the branch only to access
this module.
The system shall limit access to branch level only.
The system shall allow branch manager to add pricing tables and deleting pricing
tables. The pricing is based on adult or children or senior citizen parameters.

 Availability Module


The system shall allow branch manager and branch supervisor of the branch only to access
this module.
The system shall limit access to branch level only.
The system shall allow branch manager to add availability tables and deleting availability
tables.
The availability is based on adult or children or senior citizen parameters.

 Report Module


The system shall generate report based on account type.
a. Branch Report
b. Head Office Report
c. Customer Refund List

 Access Type

Access to the modules is determined by staff account type and branch office
location. Types of account are as follow:
 Counter Clerk
 Station Master
 Station supervisor
 Head office
 Personnel Ticket
 Checker System
 Administrator

4. EXTERNAL INTERFACEREQUIREMENT

4.1 USERINTERFACES
Keyboard, Mouse, Printer

4.2 HARDWAREINTERFACES
SERVER SIDE
 Operating System: Windows7
 Processor:Inteli5
 Memory: 4GB
 Hard Drive Capacity:750GB

CLIENT SIDE
 Operating System: Windows XP, Windows Vista orWindows7
 Browser: Internet Explorer and above. Mozilla or Google Chrome.
 Memory:512MB

4.3 SOFTWAREINTERFACES
Database
Oracle
Web Server
Apache server version 2.2.6
Programming Languages
Java
4.4 COMMUNICATIONINTERFACES
Dial Up Modem
Broadband Internet
5. NON FUNCTIONALREQUIREMENTS

5.1 PERFORMANCEREQUIREMENTS
PE-1: The system shall accommodate 400 users during the peak usage time window of 8:00am to
10:00am local time, with estimated average session duration of 45 minutes.
PE-2: All Web pages generated by the system shall be fully downloadable in no more than 10 seconds
over a 40KBps modem connection.
PE-3: Responses to queries shall take no longer than 10 seconds to load onto the screen after the user
submits the query.
PE-4: The system shall display confirmation messages to users within 4 seconds after the user submits
information to the system.
Variety of compartments based on comfort:
1. AC first-class
2. A sleeper
3. First class
4. AC three tier
5. sleeper class
6. Ordinary chair car
Types of concerns and complexities:
1. 44 types of quotas
2. 8 types of trains
3. 9 types of classes
4. 162 types of concessions
5. 127 types of bogies

5.2 SAFETYREQUIREMENTS
No safety requirements have been identified.

5.3 SECURITYREQUIREMENTS
SE-1: Users shall be required to log in to the RRS for their own reservation information and
modification with e-mail address and password.
SE-2: The system shall permit only authorized members who are on the list of authorized Menu
Managers to do administrator’s task.
SE-3: The system shall permit customers to view only their own previously placed orders, not orders
placed by other customers.

5.4 DESIGNCONSTRAINT
The system shall be web based system that runs on different type of browsers such as Internet
Explorer, Mozilla, and Google chrome.
There are a number of factors in the client’s environment that may restrict the choices of a designer.
Such factors include standards that must be followed, resource limits, operating environment,
reliability and security requirements and policies that may have an impact on the design of the
system. An SRS (Software Requirements Analysis and Specification) should identify and specify all
such constraints.
Standard Compliance: - This specifies the requirements for the standards the system must follow.
The standards may include the report format and accounting properties.
Hardware Limitations: -The software may have to operate on some existing or predetermined
hardware, thus imposing restrictions on the design. Hardware limitations can include the types of
machines to be used, operating system available on the system, languages supported and limits on
primary and secondary storage.
Reliability and Fault Tolerance: - Fault tolerance requirements can place a major constraint on
how the system is to be designed. Fault tolerance requirements often make the system more complex
and expensive. Requirements about system behavior in the face of certain kinds of faults are
specified. Recovery requirements are often an integral part here, detailing what the system should do
I some failure occurs to ensure certain properties. Reliability requirements are very important for
critical applications.
Security: - Security requirements are particularly significant in defense systems and database
systems. They place restrictions on the use of certain commands, control access to data, provide
different kinds of access requirements for different people, require the use of passwords and
cryptography techniques and maintain a log of activities in the system.
SOURCE CODES

Welcome Screen:

import java.awt.*;

import javax.swing.*;

class Welcome implements Runnable

JFrame f;

JLabel l1,l2,l3;

Thread t;

Login l;

ImageIcon img;

Welcome()

img=new ImageIcon("indian-rail.jpg");

t=new Thread(this);
f=new JFrame("Welcome");

f.getContentPane().setLayout(null);

f.getContentPane().setBackground(Color.yellow);

l1=new JLabel("OnLine Reservation");

l1.setBounds(250,300,900,50);

l1.setFont(new Font("Courier new",Font.BOLD,60));

l1.setForeground(Color.red);

l2=new JLabel(" _By Dushmanta Pradhan");

l2.setFont(new Font("Courier new",Font.BOLD,35));

l2.setBounds(350,380,800,40);

l2.setForeground(Color.red);

l3=new JLabel(img);

l3.setBounds(0,0,1300,1000);

f.getContentPane().add(l1);

f.getContentPane().add(l2);

f.getContentPane().add(l3);

f.setSize(1300,1000);

f.setVisible(true);

t.start();

public void run()

int x=1;

while(x<=5)

try

Thread.sleep(1000);
}

catch(Exception e)

{}

x++;

f.setVisible(false);

l=new Login();

Login Screen

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

class Login implements ActionListener

JFrame f;

JLabel l1,l2;

JTextField t1;

JPasswordField t2;

JButton b1,b2;

Main M;

Login()

f=new JFrame("Login");

f.getContentPane().setLayout(null);
f.getContentPane().setBackground(Color.pink);

l1=new JLabel("User Name");

l1.setForeground(Color.yellow);

l1.setBounds(50,50,100,30);

l2=new JLabel("Password");

l2.setForeground(Color.yellow);

l2.setBounds(50,80,100,30);

t1=new JTextField(10);

t1.setForeground(Color.blue);

t1.addActionListener(this);

t1.setBounds(150,50,100,30);

t2=new JPasswordField(10);

t2.setForeground(Color.blue);

t2.setEchoChar('*');

t2.addActionListener(this);

t2.setBounds(150,80,100,30);

b1=new JButton("Ok");

b1.setForeground(Color.blue);

b1.addActionListener(this);

b1.setBounds(50,120,100,30);

b2=new JButton("Cancel");

b2.setForeground(Color.blue);

b2.addActionListener(this);

b2.setBounds(180,120,100,30);

b1.setMnemonic('O');

b2.setMnemonic('C');
f.getContentPane().add(l1);

f.getContentPane().add(l2);

f.getContentPane().add(t1);

f.getContentPane().add(t2);

f.getContentPane().add(b1);

f.getContentPane().add(b2);

f.setBounds(300,300,300,200);

f.setResizable(false);

f.setVisible(true);

public void actionPerformed(ActionEvent e)

if(e.getSource()==b1)

if(t1.getText().length()==0||t2.getText().length()==0)

JOptionPane.showMessageDialog(null,"Fields are empty");

else if(t1.getText().equals("dush") && t2.getText().equals("1234"))

f.setVisible(false);

M=new Main();

else

JOptionPane.showMessageDialog(null,"Invalid User Name or Password");

}
if(e.getSource()==b2)

f.setVisible(false);

System.exit(0);

Main Screen:

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

class Main implements ActionListener

JFrame f;

JButton b1,b2,b3,b4;

Reservation r;

Enquiry q;

Cancellation c;

JLabel imgL;

ImageIcon img;

Main()

img=new ImageIcon("Indian-Railway-Network.jpg");

imgL=new JLabel(img);

imgL.setBounds(0,0,1300,1000);
f=new JFrame("Main");

f.getContentPane().setLayout(null);

f.getContentPane().setBackground(Color.green);

b1=new JButton("Reservation Form");

b1.addActionListener(this);

b1.setBounds(150,390,210,60);

b2=new JButton("PNR-enquiry");

b2.addActionListener(this);

b2.setBounds(150,490,210,60);

b3=new JButton("Cancellation Form");

b3.addActionListener(this);

b3.setBounds(580,390,210,60);

b4=new JButton("Exit");

b4.addActionListener(this);

b4.setBounds(580,490,210,60);

b1.setBackground(new Color(100,200,0));

b1.setForeground(new Color(255,255,255));

b2.setBackground(new Color(100,200,0));

b2.setForeground(new Color(255,255,255));

b3.setBackground(new Color(100,200,0));

b3.setForeground(new Color(255,255,255));

b4.setBackground(new Color(100,200,0));

b4.setForeground(new Color(255,255,255));

b1.setMnemonic('R');

b2.setMnemonic('P');

b3.setMnemonic('C');
b4.setMnemonic('E');

f.getContentPane().add(b1);

f.getContentPane().add(b2);

f.getContentPane().add(b3);

f.getContentPane().add(b4);

f.getContentPane().add(imgL);

f.setSize(1300,1000);

f.setVisible(true);

public void actionPerformed(ActionEvent e)

if(e.getSource()==b1)

f.setVisible(false);

r=new Reservation();

if(e.getSource()==b2)

f.setVisible(false);

q=new Enquiry();

if(e.getSource()==b3)

f.setVisible(false);

c=new Cancellation();

if(e.getSource()==b4)
{

f.setVisible(false);

System.exit(0);

public static void main(String args[])

new Main();

Reservation Screen:

import java.awt.*;

import java.awt.event.*;

import java.sql.*;

import javax.swing.*;

class Reservation extends Connect implements ActionListener,FocusListener

JFrame f;

JLabel l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13;

JTextField t1,t2,t3,t4,t5,t6,t7;

Choice h;

JTextArea ta;

JButton b1,b2,b3;

PreparedStatement ps;

Statement st;
ResultSet rs;

int x;

JLabel imgL;

ImageIcon img;

void disable()

t1.setEnabled(false);

t2.setEnabled(false);

t3.setEnabled(false);

t4.setEnabled(false);

t5.setEnabled(false);

t6.setEnabled(false);

t7.setEnabled(false);

h.setEnabled(false);

b2.setEnabled(false);

void enable()

t1.setEnabled(true);

t2.setEnabled(true);

t3.setEnabled(true);

t4.setEnabled(true);

t5.setEnabled(true);

t6.setEnabled(true);

t7.setEnabled(true);

h.setEnabled(true);

b2.setEnabled(true);

}
Reservation()

img=new ImageIcon("LOGO1.jpg");

imgL=new JLabel(img);

imgL.setBounds(0,320,500,250);

f=new JFrame("Reservation");

f.getContentPane().setLayout(null);

f.getContentPane().setBackground(Color.green);

l1=new JLabel("PNR No");

l1.setBounds(130,50,100,30);

l2=new JLabel("Train No");

l2.setBounds(50,80,100,30);

l3=new JLabel("Train Name");

l3.setBounds(50,110,100,30);

l4=new JLabel("Class");

l4.setBounds(50,140,100,30);

l5=new JLabel("Date of Journey");

l5.setBounds(50,170,100,30);

l6=new JLabel("From");

l6.setBounds(50,200,100,30);

l7=new JLabel("To");

l7.setBounds(250,200,50,30);

l8=new JLabel("Boarding at");

l8.setBounds(50,230,100,30);

t1=new JTextField(10);

t1.setBounds(230,50,120,30);

t2=new JTextField(10);

t2.addFocusListener(this);
t2.setBounds(150,80,100,30);

t3=new JTextField(10);

t3.setBounds(150,110,100,30);

t4=new JTextField(10);

t4.setBounds(150,170,100,30);

t5=new JTextField(10);

t5.setBounds(150,200,100,30);

t6=new JTextField(10);

t6.setBounds(300,200,100,30);

t7=new JTextField(10);

t7.setBounds(150,230,100,30);

h=new Choice();

h.setBounds(150,140,100,30);

h.add("AC");

h.add("SL");

b1=new JButton("Insert");

b1.setBackground(Color.yellow);

b1.setBounds(50,270,100,30);

b1.addActionListener(this);

b2=new JButton("Next");

b2.setBackground(Color.yellow);

b2.setBounds(160,270,100,30);

b2.addActionListener(this);

b3=new JButton("Main");

b3.setBackground(Color.yellow);

b3.setBounds(270,270,100,30);

b3.addActionListener(this);
b1.setMnemonic('I');

b2.setMnemonic('N');

b3.setMnemonic('M');

f.getContentPane().add(l1);

f.getContentPane().add(l2);

f.getContentPane().add(l3);

f.getContentPane().add(l4);

f.getContentPane().add(l5);

f.getContentPane().add(l6);

f.getContentPane().add(l7);

f.getContentPane().add(l8);

f.getContentPane().add(t1);

f.getContentPane().add(t2);

f.getContentPane().add(t3);

f.getContentPane().add(t4);

f.getContentPane().add(t5);

f.getContentPane().add(t6);

f.getContentPane().add(t7);

f.getContentPane().add(h);

f.getContentPane().add(b1);

f.getContentPane().add(b2);

f.getContentPane().add(b3);

f.getContentPane().add(imgL);

f.setSize(1300,1000);

f.setVisible(true);

disable();

}
public void focusLost(FocusEvent e)

if(t2.getText().length()!=0)

try

ps=con.prepareStatement("select Train_Name from Train where Train_No=?");

ps.setString(1,t2.getText());

rs=ps.executeQuery();

if(rs.next())

t3.setText(rs.getString(1));

catch(Exception e1)

System.out.println("Connection failed:"+e1);

public void focusGained(FocusEvent e)

{}

public void actionPerformed(ActionEvent e)

if(e.getSource()==b1)

enable();

b1.setEnabled(false);
try

st=con.createStatement();

rs=st.executeQuery("select * from PNR");

rs.next();

x=rs.getInt(1);

t1.setText(String.valueOf(x));

catch(Exception e1)

System.out.println("Connection failed:"+e1);

if(e.getSource()==b2)

try

ps=con.prepareStatement("insert into Reservation values(?,?,?,?,?,?,?,?)");

ps.setString(1,t1.getText());

ps.setString(2,t2.getText());

ps.setString(3,t3.getText());

ps.setString(4,h.getSelectedItem());

ps.setString(5,t4.getText());

ps.setString(6,t5.getText());

ps.setString(7,t6.getText());

ps.setString(8,t7.getText());

ps.executeUpdate();
//update PNR no.

ps=con.prepareStatement("update PNR set PNR_No=? where PNR_No=?");

ps.setInt(1,(x+1));

ps.setInt(2,x);

ps.executeUpdate();

JOptionPane.showMessageDialog(null, "Record Saved");

b1.setEnabled(true);

b2.setEnabled(false);

f.setVisible(false);

catch(Exception e1)

System.out.println("Connection failed:"+e1);

try

st=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);

rs=st.executeQuery("select * from Reservation");

rs.last();

x=rs.getInt(1);

Passenger P=new Passenger(x);

st=con.createStatement();

rs=st.executeQuery("select * from PassengerID");

rs.next();

x=rs.getInt(1);
P.t1.setText(String.valueOf(x));

ps=con.prepareStatement("update PassengerID set PID=? where PID=?");

ps.setInt(1,(x+1));

ps.setInt(2,x);

ps.executeUpdate();

catch(Exception e1)

System.out.println("Connection failed:"+e1);

if(e.getSource()==b3)

f.setVisible(false);

new Main();

public static void main(String args[])

new Reservation();

Passenger.java

import java.awt.*;
import java.awt.event.*;

import java.sql.*;

import javax.swing.*;

class Passenger extends Connect implements ActionListener

JFrame f;

JLabel l1,l2,l3,l4,l5,l6;

JTextField t1,t2,t3;

JButton b1,b2,b3;

Checkbox c1,c2,c3,c4,c5;

CheckboxGroup cbg;

JTextArea ta;

PreparedStatement ps;

Statement st;

ResultSet rs;

int pno;

JLabel imgL;

ImageIcon img;

Passenger(int p)

pno=p;

img=new ImageIcon("LOGO2.jpg");

imgL=new JLabel(img);

imgL.setBounds(0,400,400,200);

f=new JFrame("Passenger");

f.getContentPane().setLayout(null);

f.getContentPane().setBackground(Color.green);

l1=new JLabel("PId");
l1.setBounds(50,50,100,30);

t1=new JTextField(10);

t1.setBounds(170,50,100,30);

l2=new JLabel("Name of Passenger");

l2.setBounds(50,80,120,30);

t2=new JTextField(10);

t2.setBounds(170,80,100,30);

l3=new JLabel("Age");

l3.setBounds(50,130,100,30);

t3=new JTextField(10);

t3.setBounds(150,130,50,30);

l4=new JLabel("Gender");

l4.setBounds(250,130,50,30);

ta=new JTextArea(5,10);

ta.setBounds(150,170,130,70);

l5=new JLabel("Address");

l5.setBounds(50,170,100,30);

l6=new JLabel("Catagory");

l6.setBounds(50,240,100,30);

b1=new JButton("More");

b1.setBackground(Color.yellow);

b1.addActionListener(this);

b1.setBounds(50,330,100,30);

b2=new JButton("Save");

b2.setBackground(Color.yellow);

b2.addActionListener(this);

b2.setBounds(170,330,100,30);

b3=new JButton("Back");
b3.setBackground(Color.yellow);

b3.addActionListener(this);

b3.setBounds(290,330,100,30);

b1.setMnemonic('M');

b2.setMnemonic('S');

b3.setMnemonic('B');

cbg=new CheckboxGroup();

c1=new Checkbox("Male",cbg,true);

c1.setBounds(300,130,100,30);

c2=new Checkbox("Female",cbg,false);

c2.setBounds(300,160,100,30);

c3=new Checkbox("General");

c3.setBounds(150,240,100,30);

c4=new Checkbox("Senior Citizen");

c4.setBounds(150,270,100,30);

c5=new Checkbox("Ex-serviceman");

c5.setBounds(150,300,100,30);

f.getContentPane().add(l1);

f.getContentPane().add(l2);

f.getContentPane().add(l3);

f.getContentPane().add(l4);

f.getContentPane().add(l5);

f.getContentPane().add(l6);

f.getContentPane().add(t1);

f.getContentPane().add(t2);

f.getContentPane().add(t3);
f.getContentPane().add(ta);

f.getContentPane().add(b1);

f.getContentPane().add(b2);

f.getContentPane().add(b3);

f.getContentPane().add(c1);

f.getContentPane().add(c2);

f.getContentPane().add(c3);

f.getContentPane().add(c4);

f.getContentPane().add(c5);

f.getContentPane().add(imgL);

f.setSize(1300,1000);

f.setVisible(true);

public void actionPerformed(ActionEvent e)

if(e.getSource()==b1)

try

//saving existing record

String cat="";

ps=con.prepareStatement("insert into TempPassenger values(?,?,?,?,?,?,?)");

ps.setString(1,t1.getText());

ps.setString(2,t2.getText());

ps.setString(3,t3.getText());

ps.setString(4,cbg.getSelectedCheckbox().getLabel());

ps.setString(5,ta.getText());

if(c3.getState())
cat+=c3.getLabel()+",";

if(c4.getState())

cat+=c4.getLabel()+",";

if(c5.getState())

cat+=c5.getLabel()+",";

ps.setString(6,cat);

ps.setInt(7,pno);

ps.executeUpdate();

ps.close();

//opening new form

Passenger P=new Passenger(pno);

st=con.createStatement();

rs=st.executeQuery("select * from PassengerID");

rs.next();

int x=rs.getInt(1);

P.t1.setText(String.valueOf(x));

st.close();

//update passenger id

ps=con.prepareStatement("update PassengerID set PID=? where PID=?");

ps.setInt(1,(x+1));

ps.setInt(2,x);

ps.executeUpdate();

ps.close();

catch(Exception e1)

System.out.println("Connection failed:"+e1);
}

if(e.getSource()==b2)

try

String cat="";

ps=con.prepareStatement("insert into TempPassenger values(?,?,?,?,?,?,?)");

ps.setString(1,t1.getText());

ps.setString(2,t2.getText());

ps.setString(3,t3.getText());

ps.setString(4,cbg.getSelectedCheckbox().getLabel());

ps.setString(5,ta.getText());

if(c3.getState())

cat+=c3.getLabel()+",";

if(c4.getState())

cat+=c4.getLabel()+",";

if(c5.getState())

cat+=c5.getLabel()+",";

ps.setString(6,cat);

ps.setInt(7,pno);

ps.executeUpdate();

ps.close();

st=con.createStatement();

rs=st.executeQuery("select * from TempPassenger");

while(rs.next())
{

ps=con.prepareStatement("insert into Passenger values(?,?,?,?,?,?,?)");

ps.setString(1,rs.getString(1));

ps.setString(2,rs.getString(2));

ps.setString(3,rs.getString(3));

ps.setString(4,rs.getString(4));

ps.setString(5,rs.getString(5));

ps.setString(6,rs.getString(6));

ps.setString(7,rs.getString(7));

ps.executeUpdate();

ps.close();

st=con.createStatement();

st.executeUpdate("delete from TempPassenger");

JOptionPane.showMessageDialog(null,"Record Saved");

b2.setEnabled(false);

b1.setEnabled(false);

st.close();

catch(Exception e1)

System.out.println("Connection failed:"+e1);

if(e.getSource()==b3)

f.setVisible(false);
new Reservation();

public static void main(String args[])

new Passenger(0);

Enquiry. Java:

import java.awt.*;

import java.awt.event.*;

import java.sql.*;

import javax.swing.*;

class Enquiry extends Connect implements ActionListener

JFrame f;

JLabel l1,l2;

JTextField t;

List li;

JButton b1,b2;

PreparedStatement ps;

ResultSet rs;

JLabel imgL;

ImageIcon img;

Enquiry()
{

img=new ImageIcon("LOGO1.jpg");

imgL=new JLabel(img);

imgL.setBounds(0,340,500,200);

f=new JFrame("PNR-Enquiry");

f.getContentPane().setLayout(null);

f.getContentPane().setBackground(Color.green);

l1=new JLabel("PNR No");

l1.setBounds(50,50,60,30);

l2=new JLabel("PNR Details");

l2.setBounds(50,80,100,30);

t=new JTextField(10);

t.addActionListener(this);

t.setBounds(110,50,150,30);

li=new List();

li.setBounds(50,110,390,180);

b1=new JButton("Check");

b1.setBackground(Color.yellow);

b1.addActionListener(this);

b1.setBounds(70,300,100,30);

b2=new JButton("Back");

b2.setBackground(Color.yellow);

b2.addActionListener(this);

b2.setBounds(210,300,100,30);

b1.setMnemonic('C');

b2.setMnemonic('B');
f.getContentPane().add(l1);

f.getContentPane().add(l2);

f.getContentPane().add(t);

f.getContentPane().add(li);

f.getContentPane().add(b1);

f.getContentPane().add(b2);

f.getContentPane().add(imgL);

f.setSize(1300,1000);

f.setVisible(true);

public void actionPerformed(ActionEvent e)

if(e.getSource()==b1)

try

//reservation information

ps=con.prepareStatement("select * from Reservation where PNR_No=?");

ps.setString(1,t.getText());

rs=ps.executeQuery();

rs.next();

li.clear();

li.add("Train No.: "+rs.getString(2));

li.add("Train Name: "+rs.getString(3));

li.add("Class: "+rs.getString(4));

li.add("Date of Journey: "+rs.getString(5));

li.add("From: "+rs.getString(6));

li.add("To: "+rs.getString(7));
li.add("Boarding at: "+rs.getString(8));

//passeneger information

ps=con.prepareStatement("select * from Passenger where PNR_No=?");

ps.setString(1,t.getText());

rs=ps.executeQuery();

while(rs.next())

li.add("Passenger Name: "+rs.getString(2));

li.add("Age: "+rs.getString(3));

li.add("Gender: "+rs.getString(4));

catch(Exception e1)

System.out.println("connection failed:"+e1);

if(e.getSource()==b2)

f.setVisible(false);

new Main();

public static void main(String args[])

new Enquiry();

}
}

Cancellation Form:

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import java.sql.*;

class Cancellation extends Connect implements ActionListener,ItemListener

JFrame f;

JLabel l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11;

JTextField t1,t2,t3,t4,t5,t6,t7;

JButton b1,b2;

Choice h;

List li;

PreparedStatement ps;

ResultSet rs;

Statement st;

Cancellation()

f=new JFrame("Cancellation");

f.getContentPane().setLayout(null);

f.getContentPane().setBackground(Color.green);

l1=new JLabel("PNR No");

l1.setBounds(130,50,50,30);
l2=new JLabel("Train No");

l2.setBounds(50,90,100,30);

l3=new JLabel("Train Name");

l3.setBounds(50,120,100,30);

l4=new JLabel("Class");

l4.setBounds(50,150,100,30);

l5=new JLabel("Date of Journey");

l5.setBounds(50,180,100,30);

l6=new JLabel("From");

l6.setBounds(50,210,100,30);

l7=new JLabel("To");

l7.setBounds(250,210,50,30);

l8=new JLabel("Boarding at");

l8.setBounds(50,240,100,30);

l9=new JLabel("Name of Passenger");

l9.setBounds(90,290,120,30);

l10=new JLabel("Age");

l10.setBounds(240,290,30,30);

l11=new JLabel("Gender");

l11.setBounds(290,290,100,30);

b1=new JButton("Ok");

b1.setBackground(Color.yellow);

b1.addActionListener(this);

b1.setBounds(50,480,100,30);

b2=new JButton("Back");

b2.setBackground(Color.yellow);

b2.addActionListener(this);

b2.setBounds(200,480,100,30);
b1.setMnemonic('O');

b2.setMnemonic('B');

h=new Choice();

h.setBounds(230,50,140,30);

h.addItemListener(this);

t1=new JTextField(10);

t1.addActionListener(this);

t1.setBounds(150,90,100,30);

t2=new JTextField(10);

t2.addActionListener(this);

t2.setBounds(150,120,100,30);

t3=new JTextField(10);

t3.addActionListener(this);

t3.setBounds(150,150,100,30);

t4=new JTextField(10);

t4.addActionListener(this);

t4.setBounds(150,180,100,30);

t5=new JTextField(10);

t5.addActionListener(this);

t5.setBounds(150,210,100,30);

t6=new JTextField(10);

t6.addActionListener(this);

t6.setBounds(300,210,100,30);

t7=new JTextField(10);

t7.addActionListener(this);

t7.setBounds(150,240,100,30);
li=new List(5,true);

li.setBounds(80,320,320,100);

f.getContentPane().add(l1);

f.getContentPane().add(l2);

f.getContentPane().add(l3);

f.getContentPane().add(l4);

f.getContentPane().add(l5);

f.getContentPane().add(l6);

f.getContentPane().add(l7);

f.getContentPane().add(l8);

f.getContentPane().add(l9);

f.getContentPane().add(l10);

f.getContentPane().add(l11);

f.getContentPane().add(b1);

f.getContentPane().add(b2);

f.getContentPane().add(h);

f.getContentPane().add(t1);

f.getContentPane().add(t2);

f.getContentPane().add(t3);

f.getContentPane().add(t4);

f.getContentPane().add(t5);

f.getContentPane().add(t6);

f.getContentPane().add(t7);

f.getContentPane().add(li);

f.setSize(1300,1000);

f.setVisible(true);

start();

}
public void start()

try

st=con.createStatement();

rs=st.executeQuery("select * from Reservation");

while(rs.next())

h.add(rs.getString(1));

catch(Exception e)

System.out.println("Connection failed:"+e);

public void itemStateChanged(ItemEvent e)

System.out.println((String)h.getSelectedItem());

try

li.removeAll();

ps=con.prepareStatement("select * from Reservation where PNR_No=?");

ps.setString(1,h.getSelectedItem());

rs=ps.executeQuery();

rs.next();

t1.setText(rs.getString(2));

t2.setText(rs.getString(3));
t3.setText(rs.getString(4));

t4.setText(rs.getString(5));

t5.setText(rs.getString(6));

t6.setText(rs.getString(7));

t7.setText(rs.getString(8));

ps=con.prepareStatement("select * from Passenger where PNR_No=?");

ps.setString(1,h.getSelectedItem());

rs=ps.executeQuery();

while(rs.next())

li.add(rs.getString(2)+" "+rs.getString(3)+" "+rs.getString(4));

catch(Exception e1)

System.out.println("Connection failed"+e1);

public void actionPerformed(ActionEvent e)

if(e.getSource()==b1)

try

ps=con.prepareStatement("delete from Reservation where PNR_No=?");

ps.setString(1,h.getSelectedItem());

ps.executeUpdate();
ps=con.prepareStatement("delete from Passenger where PNR_No=?");

ps.setString(1,h.getSelectedItem());

ps.executeUpdate();

JOptionPane.showMessageDialog(null,"Reservation Cancelled");

f.setVisible(false);

catch(Exception e1)

System.out.println("Connection failed:"+e1);

if(e.getSource()==b2)

f.setVisible(false);

new Main();

public static void main(String args[])

new Cancellation();

Connect.java

import java.sql.*;
public class Connect

public Connection con;

public Connect()

try

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

con=DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver


(*.mdb)};DBQ=Railway.mdb;DriverID=22");

catch(Exception e1)

System.out.println("Connection failed:"+e1);

You might also like