Railway reservation system

8,996 views 97 slides Jul 08, 2021
Slide 1
Slide 1 of 97
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52
Slide 53
53
Slide 54
54
Slide 55
55
Slide 56
56
Slide 57
57
Slide 58
58
Slide 59
59
Slide 60
60
Slide 61
61
Slide 62
62
Slide 63
63
Slide 64
64
Slide 65
65
Slide 66
66
Slide 67
67
Slide 68
68
Slide 69
69
Slide 70
70
Slide 71
71
Slide 72
72
Slide 73
73
Slide 74
74
Slide 75
75
Slide 76
76
Slide 77
77
Slide 78
78
Slide 79
79
Slide 80
80
Slide 81
81
Slide 82
82
Slide 83
83
Slide 84
84
Slide 85
85
Slide 86
86
Slide 87
87
Slide 88
88
Slide 89
89
Slide 90
90
Slide 91
91
Slide 92
92
Slide 93
93
Slide 94
94
Slide 95
95
Slide 96
96
Slide 97
97

About This Presentation

Railway Reservation System Software Project


Slide Content

Page 1


Railway
Reservation
System



SUBJECT: Software Engineering Lab
SUBJECT CODE: CMSPCOR15P
SUBMITTED BY:
KOYEL MAJUMDAR
ROLL NO:
REGISTRATION NO: 1011621400088

RINA PAUL
ROLL NO:
REGISTRATION NO: 2014009633

LAGNAJITA HALDER
ROLL NO:
REGISTRATION NO: 1011921401740

Page 2

CERTIFICATE OF APPROVAL
This is to certify that the project entitled “Railway Reservation
System” has been carried out by KOYEL MAJUMDAR and RINA PAUL
and LAGNAJITA HALDER under my supervision in partial fulfillment
for the Degree of Master of Science (M.Sc.) in Computer Science of
Acharya Prafulla Chandra College, New Barrackpur affiliated to West
Bengal State University during the academic year 2020-21.

It is understood that by this approval the undersigned do not
necessarily endorse any of the statement made or opinion expressed
therein but approves it only for the purpose for which it is submitted.

Submitted By
Koyel Majumdar
Registration No. 1011621400088 of 2019-21
Roll No.

Rina Paul
Registration No. 2014009633 of 2019-21
Roll No.

Lagnajita Halder
Registration No. 1011921401740 of 2019-21
Roll No.



(Prof. Joydeb Das Biswas) (Prof. Gobinda Karmakar)
Head of the Department of Project Supervisor
Computer science Department of Computer
Science

Page 3


INDEX

Page 4

ASSIGNMENT 01
1. INTRODUCTION
1.1 Purpose: The purpose of this project is to
describe the railway reservation system, which
provides the train timing details, reservation, billing
and cancellation all various types of reservation
namely. In addition, this railway reservation service
will not only enhance the reservation but will also
help the commuters in getting support, refunds and
other real time fixes.
 Confirm reservation of confirm seat
 Reservation against cancellation
 Waiting list reservation
 Online reservation
 Total reservation
1.2 Scope: The main purpose of this system is
o Creating reservation
o Cancel reservation
o View reservation status
o View train schedule
o Generating reports
o Update train schedule
o Update reservation details
The scope of this system in creating reservation is that, from
any railway station we can create reservation which is updated
automatically in all the station. Hence, there is no confusion to
the reservation clerk in all the station to create the reservation.

Page 5

This can be possible by maintaining global database. Clerks
present at different station can access the global database and
the clerks can easily understand the remaining reservation seats.
It provides the ability to create reservation from different places
for a train.
The various advantages of using the online reservation system
are as follows:
 Convenient- We can book or cancel our tickets sitting in
the comfort of our home or office.
 Saves time and effort- We can save the time needed to
travel to the railway reservation office and waiting in the
queue for our turn.
 Towards a greener planet- Instead of printing our ticket
we can also choose to travel with the SMS or soft copy of
our booked ticket in our laptop or even on our mobile.

1.3
Definitions, acronyms and
abbreviations:

2. User- Someone who interact with the mobile
phone application.
3. Admin/Administrator- System administrator
who is given specific permission for managing and controlling the system.
4. Application Store- An installed application on
mobile phone which helps user to find new

Page 6

compatible applications with mobile phone
platform and download them from Internet.
5. Stakeholder- Any person who has interaction
with the system who is not a developer.
6. GPS- Global Positioning System.
7. NTES- National Train Enquiry System
8. IVRS- Interactive Voice Response System
9. PRS- Passenger Reservation System
The last three consists of
o Train details
o Reservation form
o Billing
o Cancellation
1.4 References: We have referenced from many a sites to get
information / for knowledge gathering to understand the
current scenario of the market, below are the references we
have got help from, and we acknowledge the same:
o www.scribd.com

o Wikipedia.org
o www.slideshare.net
o www.intel.com
o www.academia.edu

2. OVERALL DESCRIPTION
2.1 Product Perspective: Before making this a
real time running online reservation system, old

Page 7

system suffered from many of the DRAWBACKS,
such as:
 The existing system is highly manual
involving a lot of paper work and calculation
and therefore may be erroneous. This has led
to inconsistency and inaccuracy in the
maintenance of data.
 Due to manual working, it is difficult to add,
delete, update or view the data.
 The data, which is stored on the paper only,
may be lost, stolen or destroyed due to any
natural calamity of fire or water.
 Since number of passengers has increased to
an uncertain multiple, it is very difficult to
maintain or retrieve detailed record of
passengers.
 Existing system is sluggish and consumes a lot
of time causing inconvenience to customers
and staff.
 A railway has many offices around the world
an absence of link between them all causes to
a lack of miscommunication and disco-
ordination.
Hence, this railway reservation system is
proposed, with following benefits:
 Reservation, cancellation
or updatation lists of
ticket’s can easily be

Page 8

maintained and retrieved
and any required additions,
deletion or updatation can
easily be performed.
 Computerization of
reservation system will
reduce a lot of daily paper
work and hence load on
the staff of admin
department.
 This system provide User
name-Password validation,
hence unauthorized access
is prevented.
2.2 Functional Requirements: With this in
mind, an important feature of this software is that it
can be relatively simple to use. The scope of this
project encompasses:
1. Enquiry: This function allows the user to
search for train that is available between two
travel cities namely “Departure City” and
“Arrival City” as desired by the traveler. The
system initially prompts the agent for these
two column values, the date of the journey,
preferred time slot and the number of
passengers. It then displays a list of trains
available with different classes.
2. User Registration: The function allows to fill
up all the field like name, phone number,

Page 9

address. Then generate user id and password
for further login.
3. Login: This function allows log in to the
system after entering user id and password.
4. Ticket Booking:
 Passenger Information: This system
asks for details of all the passenger
before the booking confirmation.
Hence, lesser cases of seat issues.
 Payment: It requires details of
credit/debit card of the person to make
payment and reserve the required seat,
details such as:
o Card Number
o Card Type
o CVV Number
o Expiry Date
o Name on the Card
5. Cancellation: System also allow cancellation
of existing reservation done, making seats
unreserved for others to book and refunding
the money back to the accounts of users
cancelling the tickets.
6. PNR Status: System allow to find out train
travel details, we need to check PNR status
first. Every train has limited number of seats,
sometime one may not get a confirmed
reserved ticket. The current status of such a
waitlist(W/L) ticket changes when there is

Page 10

any availability of reserved seats due to
cancellation. This new current reservation
status is known as PNR Status.
2.3 User Characteristics: There are two types of
users that interact with the system: Customer and
Railway admin. Each of these two types of users has
different use of the system so each of them has their
own requirements.

The customer is used to search train, book ticket,
view reservation status, cancel ticket and pay for
tickets.

Railway admin add and update train information
and generate reports. And approve the customer
information, cancellation request etc. And refund
fare amount of money to the customer.
2.4
Constraints: Software constraints:
The system will run under windows 98, windows 7,
windows Xp and higher platforms of operating
system with at least Internet Explorer 8 installed.
3. SPECIFIC REQUIREMENTS
3.1.1 User interfaces: For the efficient working
of the User interface i.e. the Front End of the
system, the OS must be having at least
Internet Explorer 8 installed to log into the
website.

Page 11

3.1.2 Hardware interfaces: For the hardware
requirements, the SRS specifies the logical
characteristics of each interface between the
software product and the hardware
components. It specifies the hardware
requirements like memory restriction, cache
size, processor, RAM etc. those are required
for software to run.
Minimum Hardware Requirements
Processor Pentium IV
HDD 40 GB
RAM 128 MB
Cache 512 kb
3.1.3 Software interfaces:
For hosting- Any windows operating system
with DOS support and Visual studio for development. Primarily Windows 7 installed with a working LAN connection to be
mandatory.
For using- Any type of operating system with
at least Internet Explorer installed and having
minimum of 512 kbps working LAN
compulsory.
3.1.4
Communication interfaces: Indian
Railway’s website, www.indianrail.gov.in
offers PRS enquiries on the internet

Page 12

berth/seat 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 any given station.
Mobile telephone based SMS enquiry service.
A new mobile phone based facility for rail
users’ which is Country wide extension of
Universal Rail Enquiry number “139” through
setting up of Interactive Voice Response
System(IVRS).
3.2
Non-functional Requirements:
 Security- The system use SSL(Secured
Socket Layer) in all transactions that include any confidential customer information. The
system must automatically log out all
customers after a period of inactivity. The
system should not leave any cookies on the
customer’s computer containing the user’s
password. The system’s back-end servers
shall only be accessible to authenticated
management.
 Maintainability- A commercial database is
used for maintaining the database and the
application server takes care of the site. In
case of a failure, a re initialization of the

Page 13

project will be done. Also the software design
is being done with modularity in mind so
that maintainability can be done efficiently.
 Availability- The system should be available
at all times, meaning the user can access it
using a web browser, only restricted by the
down time of the server on which the system
runs. A customer friendly system which is in
access of people around the world should
work 24 hours. In case of a hardware failure
or database corruption, a replacement page
will be shown. Also, in case of a hardware
failure or database corruption, backups of
the database should be retrieved from the
server and saved by the organizer. Then the
service will be restarted. It means 24*7
availability.
 Reliability- The reliability of the overall
project depends on the reliability of the
separate components. The main pillar of
reliability of the system is the backup of the
database which is continuously maintained
and updated to reflect the most recent
changes. Also the system will be functioning
inside a container. Thus the overall stability
of the system depends on the stability of
container and its underling operating system.
 Supportability- The code and supporting
modules of the system will be well

Page 14

documented and easy to understand. Online
user documentation and help system
requirements.
 Disaster Recovery- The system is able to
avoid or tackle disastrous action. In other
words, it should be foul proof. The system
safeguards against undesired events, without
human intervention.











ASSIGNMENT 02

Page 15

Gantt Chart
 A Gantt chart used in project management, is one of the
most popular and useful ways of showing activities(tasks
or events) displayed against time.
 On the left of the chart is a list of activities and along the
top is a suitable time scale.
 Each activity is represented by a bar; the position and
length of the bar reflects the start date, duration and end
date of the activity.


PERT Chart
 A PERT abbreviated as Project Evaluation and Review
Technique.

Page 16

 It illustrates the project as a network diagram consisting
of the number of nodes representing events.
 It consist of network boxes and arrows.








ASSIGNMENT 03

Page 17

 Use Case Diagram


Actor Response Description:
Use case #: 001
Process Name- Enquiry
Actor- Customer
Description- A link of enquiry or check
availability is displayed.
If you click on the above option then the equivalent page
will displayed.
Main flow of events-
AA: Customer submit information about
the date, arrival city, departure city, train and check the
availability of tickets.

Page 18

SR: Generate a message box and show the
result of search.

Use case #: 002
Process Name- User Registration
Actor- Customer, Railway Admin
Description- A link of user registration is
displayed.
If you click on the above option then the equivalent page
will be displayed.
Main flow of events-
AA(C): Fill up all the fields and press save
button.
SR: Generate a message box and give
message to success or failure.
AA(RA): Approve/ cancel button press
after document verification. And give the customer user
id and password for further login.
SR: Generate a message box and give a
message of success or failure.
Exception flow of events-
For customer:
o Generate a message text
field is empty.
o Generate a message if
length of input is out of
range.
Use case #: 003

Page 19

Process Name- Login
Actor- Customer
Description- A link of login is displayed.
If you click on the above option then the equivalent page
will be displayed.
Main flow of events-
AA(C): Enter user id and password and
press Log In button.
SR: Generate a message of successful or
failure login.
Exception flow of events-
Generate a message wrong user id
or password.

Use case #: 004
Process Name- Booking
Actor- Customer, Railway Admin
Description- A link of book ticket is
displayed.
If you click on the above option then the equivalent page
will be displayed.
Main flow of events-
AA(C): After login first choose available
train and press book now option.
SR: Generate a message box and give
message of successful booking.
Exception flow of events-
AA(RA): Approve button press and give
the customer printout of tickets.

Page 20

SR: Generate a message box and give
message of success.

Use case #: 005
Process Name- Passenger information
Actor- Customer
Description- A link of passenger
information is displayed.
If you click on the above option then the equivalent page
will be displayed.
Main flow of events-
AA: For booking fill the details of
passenger information.
SR: Generate a message box of submit
details.
Exception flow of events-
Generate a message if text field is
empty or customer information is incorrect.


Use case #: 006
Process Name- Payment
Actor- Customer, Railway Admin
Description- A link of cancel ticket is
displayed.
If you click on the above option then the equivalent page
will be displayed.
Main flow of events-
AA(C): Put the details of credit/ debit card
of customer and make payment.

Page 21

SR: Generate a message of successful
payment.
AA(RA): Generate a OTP for customer and
after payment press success button and give payment
receipt to the customer.
SR: Generate a message box and give
message of success /failure.
Exception flow of events-
Generate a message for incorrect
card details.

Use case #: 007
Process Name- Cancellation
Actor- Customer, Railway Admin
Description- A link of cancel ticket is
displayed.
If you click on the above option then the equivalent page
will be displayed.
Main flow of events-
AA(C): First login in the system then press
ticket cancellation button. There click the check box of
which ticket will be cancelled.
SR: System generate following two
messages:
o Generate message with
success
o Generate message of
refund money.

Page 22

AA(RA): Approve button press and give
the printout of ticket cancellation to the customer.
SR: Generate a message box and give a
message of success.

Use case #: 008
Process Name- PNR status
Actor- Customer
Description- A link of PNR status is
displayed.
If you click on the above option then the equivalent page
will be displayed.
Main flow of events-
AA: Press PNR enquiry and enter PNR
number.
SR: Generate confirmation status.

 Class Diagram

Page 23



 Sequence Diagram

Page 24

Page 25



 Activity Diagram

 User Registration

Page 26

 Login

 Ticket Booking

Page 27


 Ticket Cancel


 PNR status

Page 28

Page 29

ASSIGNMENT 04
Estimate Project Cost
Decomposition for FP-based estimation focuses on information
domain values rather than software functions. Here we estimate
external inputs, external outputs, external inquires, internal
logical files and external interface files for the software. For the
purposes of this estimate, the complexity weighting factor is
assumed to be average.
Estimation Information Domain Values

Value Adjust Factor

Page 30

The estimated number of FP is derived
FP=(total count) x [o.65 + 0.01 x ∑(Fi)]
= 704 x [0.65 + 0.01 x 36]
= 704 x 1.01
= 711
The cost per FP approximately = Rs. 10,000/-
The total estimated project cost = Rs. 7,110,000/-
The Labor Rate = Rs. 50,000/- per month
The Estimated effort = 109 person-month
The organizational average productivity of system = 6.5 FP/pm

Page 31

ASSIGNMENT 05
Login
Source Code:
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;


public class log_in extends JFrame implements
ActionListener {
private static log_in maf;
private JLabel lblName, lblpass;
private JTextField txtName;
private JPasswordField txtPassword;
private JButton submitButton, exitButton;
public log_in(){


setSize(800,600);
setTitle("logInForm");
setLocation(50,50);


ImageIcon background_image = new
ImageIcon("login.jpg");
Image img =
background_image.getImage();
Image temp_img =
img.getScaledInstance(800,600,Image.SCALE_SMOOTH);

Page 32

background_image = new
ImageIcon(temp_img);
JLabel background = new
JLabel("",background_image,JLabel.CENTER);
background.setBounds(0,0,800,600);
add(background);


lblName = new JLabel("Enter User
Name: ");
lblName.setBounds(200,50,150,30);
lblName.setBackground(Color.black);
background.add(lblName);

txtName = new JTextField(10);
txtName.setBounds(350,50,100,30);
txtName.setBackground(Color.white);
background.add(txtName);

lblpass = new JLabel("Enter Password:
");
lblpass.setBounds(200,100,150,30);
lblpass.setBackground(Color.black);
background.add(lblpass);

txtPassword = new JPasswordField(10);
txtPassword.setEchoChar('*');

txtPassword.setBounds(350,100,100,30);

txtPassword.setBackground(Color.white);
background.add(txtPassword);

Page 33

submitButton = new JButton("Sign
in");

submitButton.setBounds(250,150,75,30);

submitButton.setBackground(Color.white);


submitButton.addActionListener(this);
background.add(submitButton);

exitButton = new JButton("Sign up");
exitButton.setBounds(350,150,80,30);

exitButton.setBackground(Color.white);
exitButton.addActionListener(this);
background.add(exitButton);

setDefaultCloseOperation(
EXIT_ON_CLOSE );
}


public static void main(String args[]) {
log_in maf = new log_in();
maf.setVisible(true);
}

public void actionPerformed(ActionEvent
event) {
JButton clickedButton = (JButton)
event.getSource();

Page 34

String buttonText =
clickedButton.getText();

if(buttonText.equals("Sign in")){

//JOptionPane.showMessageDialog(null,"Su
ccessfully Login");

if(txtName.getText().equals("Project") &&
txtPassword.getText().equals("1234")){

JOptionPane.showMessageDialog(null,"Cor
rect user ");
Home ob = new Home();
ob.setVisible(true);
maf.setVisible(false);

}
else{

JOptionPane.showMessageDialog(null,"Wr
ong user ... Try again");
}
}

if(buttonText.equals("Sign up")){
Registration ob = new
Registration();
ob.setVisible(true);
maf.setVisible(false);
}

Page 35

}

}
Output:

Home Page
Source Code:
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Home extends JFrame implements ActionListener {
private static Home maf;

Page 36

//private JLabel
lblName,lblAddr,lblMob,lblMail,lblGen,lblPass;
//private JRadioButton Male,Female;
//private JTextField
txtName,txtAddr,txtMob,txtMail,txtGen;
//private JPasswordField txtPassword;
private JButton
logout,bookticket,passenger,searchtrain,pnr;
public Home(){


setSize(800,600);
setTitle("HOME PAGE");
setLocation(50,50);


ImageIcon background_image = new
ImageIcon("Home1.jpg");
Image img = background_image.getImage();
Image temp_img =
img.getScaledInstance(800,600,Image.SCALE_SMOOTH);
background_image = new
ImageIcon(temp_img);
JLabel background = new
JLabel("",background_image,JLabel.CENTER);
background.setBounds(0,0,800,600);
add(background);


//BOOK TICKET
bookticket= new JButton("BOOK TICKET");
bookticket.setBounds(200,300,200,30);
bookticket.setBackground(Color.white);

Page 37

bookticket.addActionListener(this);
background.add(bookticket);

//PASSENGER
passenger = new JButton("CANCEL");
passenger.setBounds(500,300,200,30);
passenger.setBackground(Color.white);
passenger.addActionListener(this);
background.add(passenger);

//SEARCH TRAIN
searchtrain= new JButton("SEARCH TRAIN");
searchtrain.setBounds(200,350,200,30);
searchtrain.setBackground(Color.white);
searchtrain.addActionListener(this);
background.add(searchtrain);

//PNR
pnr = new JButton("PNR");
pnr.setBounds(500,350,200,30);
pnr.setBackground(Color.white);
pnr.addActionListener(this);
background.add(pnr);

//LOGOUT
logout = new JButton("log out");
logout.setBounds(400,400,75,30);
logout.setBackground(Color.white);
logout.addActionListener(this);
background.add(logout);

setDefaultCloseOperation( EXIT_ON_CLOSE
);

Page 38

}
public void actionPerformed(ActionEvent event) {
JButton clickedButton = (JButton)
event.getSource();
String buttonText = clickedButton.getText();

if(buttonText.equals("BOOK TICKET")){

//JOptionPane.showMessageDialog(null,"Successfull
y Registered");
ticketBook ob = new ticketBook();
ob.setVisible(true);
maf.setVisible(false);



}

if(buttonText.equals("CANCEL")){

//JOptionPane.showMessageDialog(null,"Back to log
in page");
ticketCancel ob = new ticketCancel();
ob.setVisible(true);
this.setVisible(false);
}

if(buttonText.equals("SEARCH TRAIN")){

//JOptionPane.showMessageDialog(null,"Back to log
in page");
searchTrain ob = new searchTrain();
ob.setVisible(true);

Page 39

this.setVisible(false);
}

if(buttonText.equals("PNR")){

//JOptionPane.showMessageDialog(null,"Back to log
in page");
pnr ob = new pnr();
ob.setVisible(true);
this.setVisible(false);
}

if(buttonText.equals("log out")){

//JOptionPane.showMessageDialog(null,"Back to log
in page");
log_in ob = new log_in();
ob.setVisible(true);
this.setVisible(false);
}

}

}
Output:

Page 40



User Registration
Source Code:
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;


public class Registration extends JFrame implements
ActionListener {
private static Registration maf;
private JLabel
lblName,lblAddr,lblMob,lblMail,lblGen,lblPass;
private JRadioButton Male,Female;

Page 41

private JTextField
txtName,txtAddr,txtMob,txtMail,txtGen;
private JPasswordField txtPassword;
private JButton submitButton, exitButton;
public Registration(){


setSize(800,600);
setTitle("Registration Form");
setLocation(50,50);


ImageIcon background_image = new
ImageIcon("registration.jpg");
Image img = background_image.getImage();
Image temp_img =
img.getScaledInstance(800,600,Image.SCALE_SMOOTH);
background_image = new
ImageIcon(temp_img);
JLabel background = new
JLabel("",background_image,JLabel.CENTER);
background.setBounds(0,0,800,600);
add(background);

//NAME
lblName = new JLabel("Name: ");
lblName.setBounds(200,50,150,30);
lblName.setBackground(Color.black);
lblName.setForeground(new Color(255,69,0));
lblName.setFont(new
Font("Serif",Font.BOLD,15));
background.add(lblName);

Page 42

txtName = new JTextField(10);
txtName.setBounds(350,50,100,30);
txtName.setBackground(Color.white);
background.add(txtName);

//ADDRESS
lblAddr = new JLabel("Address: ");
lblAddr.setBounds(200,100,150,30);
lblAddr.setForeground(new Color(255,69,0));
lblAddr.setFont(new
Font("Serif",Font.BOLD,15));
background.add(lblAddr);

txtAddr = new JTextField(10);
txtAddr.setBounds(350,100,100,30);
txtAddr.setBackground(Color.white);
background.add(txtAddr);

//MOBILE NO.
lblMob = new JLabel("Mobile No.: ");
lblMob.setBounds(200,150,150,30);
lblMob.setForeground(new Color(255,69,0));
lblMob.setBackground(Color.white);
lblMob.setFont(new
Font("Serif",Font.BOLD,15));
background.add(lblMob);

txtMob = new JTextField(10);
txtMob.setBounds(350,150,100,30);
txtMob.setBackground(Color.white);
background.add(txtMob);
txtMob.addKeyListener(new KeyAdapter(){
public void keyPressed(KeyEvent ke){

Page 43

String value=txtMob.getText();
int l=value.length();
if(ke.getKeyChar() >= '0' &&
ke.getKeyChar() <= '9'){

txtMob.setEditable(true);
}
else{

txtMob.setEditable(false);
}
}
});


//EMAIL ID.
lblMail = new JLabel("Email id: ");
lblMail.setBounds(200,200,150,30);
lblMail.setForeground(new Color(255,69,0));
lblMail.setBackground(Color.white);
lblMail.setFont(new
Font("Serif",Font.BOLD,15));
background.add(lblMail);

txtMail = new JTextField(10);
txtMail.setBounds(350,200,100,30);
txtMail.setBackground(Color.white);
background.add(txtMail);


//GENDER
lblGen =new JLabel("Gender ");
lblGen.setBounds(200,250,150,30);

Page 44

lblGen.setForeground(new Color(255,69,0));
lblGen.setFont(new
Font("Serif",Font.BOLD,15));
background.add(lblGen);

Male =new JRadioButton("Male");
Male.setBounds(350,250,100,30);
Male.setForeground(new Color(255,69,0));
background.add(Male);

Female =new JRadioButton("Female");
Female.setBounds(500,250,100,30);
Female.setForeground(new Color(255,69,0));
background.add(Female);

ButtonGroup group1 = new ButtonGroup();
group1.add(Male);
group1.add(Female);

setVisible(true);


//password
lblPass = new JLabel("Password: ");
lblPass.setBounds(200,300,150,30);
lblPass.setForeground(new Color(255,69,0));
lblPass.setBackground(Color.white);
background.add(lblPass);

txtPassword = new JPasswordField(10);
txtPassword.setEchoChar('*');
txtPassword.setBounds(350,300,100,30);
txtPassword.setBackground(Color.white);

Page 45

background.add(txtPassword);

JCheckBox Check = new JCheckBox("I agree to
the Terms of service and Privacy policy");
Check.setBounds(200,350,320,30);
background.add(Check);

//SUBMIT
submitButton = new JButton("Sign Up");
submitButton.setBounds(250,400,85,30);
submitButton.setBackground(Color.white);
submitButton.addActionListener(this);
background.add(submitButton);

//BACK
exitButton = new JButton("Back");
exitButton.setBounds(390,400,85,30);
exitButton.setBackground(Color.white);
exitButton.addActionListener(this);
background.add(exitButton);

setDefaultCloseOperation( EXIT_ON_CLOSE
);
}

public void actionPerformed(ActionEvent event) {
JButton clickedButton = (JButton)
event.getSource();
String buttonText = clickedButton.getText();

if(buttonText.equals("Sign Up")){

Page 46


JOptionPane.showMessageDialog(null,"Successfully
Registered");
Home ob = new Home();
ob.setVisible(true);
maf.setVisible(false);



}

if(buttonText.equals("Back")){

JOptionPane.showMessageDialog(null,"Back to log
in page");
log_in ob = new log_in();
ob.setVisible(true);
this.setVisible(false);
}


}


}
Output:

Page 47


Search Train
Source Code:
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

import javax.swing.JFormattedTextField;
class searchTrain extends JFrame implements
ActionListener{
JComboBox day,month,year;

searchTrain(){
//font

Page 48

Font f = new Font("Serif",Font.BOLD,30);

JLabel name = new JLabel("Search Your Train
Easily");
name.setForeground(Color.white);
name.setBounds(20,180,350,35);
name.setFont(f);

JPanel sr = new JPanel();
sr.setLayout(null);
sr.setSize(400,350);
sr.setBackground(new Color(0,0,0,80));
sr.setBounds(530,70,310,420);

JLabel head= new JLabel("Search Train");
head.setBounds(50,20,200,30);
head.setForeground(Color.white);
head.setFont(f);
sr.add(head);

JLabel from=new JLabel("From");
from.setBounds(50,70,200,30);
from.setForeground(Color.white);
sr.add(from);

String
station[]={"KPA","NH","SDAH","HWH","RMPH","SEP","KNJ","
NJP","BKP","BNG","BT","PURI",};
JComboBox cb= new JComboBox(station);
cb.setBounds(50,110,150,30);

Page 49

cb.setBackground(new Color(255,222,173));
sr.add(cb);

JLabel to=new JLabel("To");
to.setBounds(50,150,200,30);
to.setForeground(Color.white);
sr.add(to);

String
station1[]={"KPA","NH","SDAH","HWH","RMPH","SEP","KNJ",
"NJP","BKP","BNG","BT"};
JComboBox cb1= new JComboBox(station1);
cb1.setBounds(50,180,150,30);
cb1.setBackground(new Color(255,222,173));
sr.add(cb1);

JLabel date=new JLabel("Date of Journey");
date.setBounds(50,230,200,30);
date.setForeground(Color.white);
sr.add(date);
DateFormat dateFormat = new
SimpleDateFormat("dd MMM YYYY");
JFormattedTextField today = new
JFormattedTextField(dateFormat);
today.setName("Today");
today.setColumns(10);
today.setBounds(50,260,200,30);

Page 50

today.setBackground(new Color(255,222,173));
today.setEditable(true);
today.setValue(new Date());
sr.add(today);

JLabel cls=new JLabel("Class");
cls.setBounds(50,290,200,30);
cls.setForeground(Color.white);
sr.add(cls);

String cls1[]={"AC First Class","AC 2 Tier","First
Class","AC 3 Tier","AC Chair Car","Sleeper","Second
Sitting","Exec. Chair Car"};
JComboBox cm= new JComboBox(cls1);
cm.setBounds(50,320,150,30);
cm.setBackground(new Color(255,222,173));
sr.add(cm);

JButton br = new JButton("Search");
br.setBounds(50,370,180,30);
br.setBackground(new Color(255,140,0));
sr.add(br);
br.addActionListener(this);

setSize(900,600);

Page 51

setLayout(null);
setDefaultCloseOperation( EXIT_ON_CLOSE
);
//background
ImageIcon background_image = new
ImageIcon("search.jpeg");
Image img = background_image.getImage();
Image temp_img =
img.getScaledInstance(900,600,Image.SCALE_SMOOTH);
background_image = new
ImageIcon(temp_img);
JLabel background = new
JLabel("",background_image,JLabel.CENTER);

background.add(sr);
background.add(name);
background.setBounds(0,0,900,600);
add(background);
setVisible(true);
}

public void actionPerformed(ActionEvent event) {
JButton clickedButton = (JButton)
event.getSource();
String buttonText = clickedButton.getText();
if(buttonText.equals("Search")){

JOptionPane.showMessageDialog(null,"Search
Successful");
}
else
{

Page 52


JOptionPane.showMessageDialog(null,"Not
Successful");
}
}
}
Output:

Ticket Booking
Source Code:
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;

Page 53

import java.util.Date;

class ticketBook extends JFrame implements
ActionListener{
JComboBox day,month,year;

ticketBook(){
//font
Font f = new Font("Serif",Font.BOLD,40);
Font fn = new Font("Serif",Font.BOLD,20);

//header
JPanel heading;
heading = new JPanel();
heading.setBackground(new Color(0,0,0,60));
heading.setBounds(0,0,900,90);
JLabel name = new JLabel("Ticket Booking");
name.setForeground(Color.white);
name.setBounds(200,25,400,35);
name.setFont(f);
heading.add(name);

JPanel book = new JPanel();
book.setLayout(null);
book.setSize(400,350);
book.setBackground(new Color(0,0,0,80));
book.setBounds(200,75,500,450);

Page 54

JLabel Num= new JLabel("Enter Your Train
Number");
Num.setBounds(50,50,380,30);
Num.setForeground(new Color(240,128,128));
Num.setFont(fn);
book.add(Num);

JTextField tf=new JTextField(25);
tf.setBounds(50,90,340,30);
tf.setBackground(new Color(255,240,230));
book.add(tf);
tf.addKeyListener(new KeyAdapter(){
public void keyPressed(KeyEvent ke){
String value=tf.getText();
int l=value.length();
if(ke.getKeyChar() >= '0' &&
ke.getKeyChar() <= '9'){
tf.setEditable(true);
}
else{
tf.setEditable(false);
}
}
});


JLabel from= new JLabel("Journey From");
from.setBounds(50,120,380,30);
from.setForeground(new Color(240,128,128));

Page 55

from.setFont(fn);
book.add(from);

JTextField Name= new JTextField();
Name.setBounds(50,150,340,30);
Name.setBackground(new
Color(255,240,230));
book.add(Name);

JLabel to= new JLabel("Journey To");
to.setBounds(50,190,380,30);
to.setForeground(new Color(240,128,128));
to.setFont(fn);
book.add(to);

JTextField Name2= new JTextField();
Name2.setBounds(50,220,340,30);
Name2.setBackground(new
Color(255,240,230));
book.add(Name2);

JLabel cls=new JLabel("Class");
cls.setBounds(50,260,380,30);
cls.setForeground(new Color(240,128,128));
cls.setFont(fn);
book.add(cls);

String cls1[]={"AC First Class","AC 2 Tier","First
Class","AC 3 Tier","AC Chair Car","Sleeper","Second
Sitting","Exec. Chair Car"};
JComboBox cm= new JComboBox(cls1);
cm.setBounds(50,300,340,30);
cm.setBackground(new Color(255,240,230));

Page 56

book.add(cm);

JLabel date=new JLabel("Date of Journey");
date.setBounds(50,330,200,30);
date.setForeground(new Color(240,128,128));
date.setFont(fn);
book.add(date);

DateFormat dateFormat = new
SimpleDateFormat("dd MMM YYYY");
JFormattedTextField today = new
JFormattedTextField(dateFormat);
today.setName("Today");
today.setColumns(10);
today.setBounds(50,370,340,30);
today.setBackground(new Color(255,240,230));
today.setEditable(true);
today.setValue(new Date());
book.add(today);

JButton np = new JButton("Next Page");
np.setBounds(130,410,180,30);
np.setBackground(new Color(0,206,209));
np.addActionListener(this);
book.add(np);


//frame
setSize(900,600);
setLayout(null);
setDefaultCloseOperation( EXIT_ON_CLOSE
);
//background

Page 57

ImageIcon background_image = new
ImageIcon("DTyAKC.jpg");
Image img = background_image.getImage();
Image temp_img =
img.getScaledInstance(900,600,Image.SCALE_SMOOTH);
background_image = new
ImageIcon(temp_img);
JLabel background = new
JLabel("",background_image,JLabel.CENTER);

background.add(book);
background.add(heading);
background.setBounds(0,0,900,600);
add(background);
setVisible(true);
}

public void actionPerformed(ActionEvent event) {
JButton clickedButton = (JButton)
event.getSource();
String buttonText = clickedButton.getText();

if(buttonText.equals("Next Page")){

JOptionPane.showMessageDialog(null,"Next to the
Passenger Information Page");
psInfo ob = new psInfo();
ob.setVisible(true);
this.setVisible(false);
}

}
}

Page 58

Output:

Passenger Information
Source Code:
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;


public class Passenger extends JFrame implements
ActionListener {

private static Passenger maf;

Page 59

private JLabel
lblName,lblAddr,lblMob,lblMail,lblGen,lblbank,lblbranch,l
blifsc,lblacnt;
private JRadioButton Male,Female;
private JTextField
txtName,txtAddr,txtMob,txtMail,txtGen,txtbank,txtbranch,
txtifsc,txtacnt;
private JButton submitButton, cancelButton;
public Passenger(){


setSize(800,600);
setTitle("Passengers details");
setLocation(50,50);


ImageIcon background_image = new
ImageIcon("passenger.jpg");
Image img = background_image.getImage();
Image temp_img =
img.getScaledInstance(800,600,Image.SCALE_SMOOTH);
background_image = new
ImageIcon(temp_img);
JLabel background = new
JLabel("",background_image,JLabel.CENTER);
background.setBounds(0,0,800,600);
add(background);

//NAME
lblName = new JLabel("Name: ");
lblName.setBounds(200,50,150,30);
lblName.setBackground(Color.white);
lblName.setForeground(Color.cyan);

Page 60

lblName.setFont(new
Font("Serif",Font.BOLD,20));
background.add(lblName);

txtName = new JTextField(10);
txtName.setBounds(350,50,100,30);
txtName.setBackground(Color.white);
background.add(txtName);

//ADDRESS
lblAddr = new JLabel("Address: ");
lblAddr.setBounds(200,100,150,30);
lblAddr.setForeground(Color.white);
lblAddr.setForeground(Color.cyan);
lblAddr.setFont(new
Font("Serif",Font.BOLD,20));
background.add(lblAddr);

txtAddr = new JTextField(10);
txtAddr.setBounds(350,100,100,30);
txtAddr.setBackground(Color.white);
background.add(txtAddr);

//MOBILE NO.
lblMob = new JLabel("Mobile No.: ");
lblMob.setBounds(200,150,150,30);
lblMob.setForeground(Color.cyan);
lblMob.setBackground(Color.white);
lblMob.setFont(new
Font("Serif",Font.BOLD,20));
background.add(lblMob);

txtMob = new JTextField(10);

Page 61

txtMob.setBounds(350,150,100,30);
txtMob.setBackground(Color.white);
background.add(txtMob);



//EMAIL ID.
lblMail = new JLabel("Email id: ");
lblMail.setBounds(200,200,150,30);
lblMail.setForeground(Color.cyan);
lblMail.setBackground(Color.white);
lblMail.setFont(new
Font("Serif",Font.BOLD,20));
background.add(lblMail);

txtMail = new JTextField(10);
txtMail.setBounds(350,200,100,30);
txtMail.setBackground(Color.white);
background.add(txtMail);


//GENDER
lblGen =new JLabel("Gender ");
lblGen.setBounds(200,250,150,30);
lblGen.setForeground(Color.cyan);
lblGen.setFont(new
Font("Serif",Font.BOLD,20));
background.add(lblGen);

Male =new JRadioButton("Male");
Male.setBounds(350,250,100,30);
background.add(Male);

Page 62

Female =new JRadioButton("Female");
Female.setBounds(500,250,100,30);
background.add(Female);

ButtonGroup group1 = new ButtonGroup();
group1.add(Male);
group1.add(Female);

//BANK NAME
lblbank = new JLabel("Bank name: ");
lblbank.setBounds(200,300,150,30);
lblbank.setForeground(Color.cyan);
lblbank.setBackground(Color.white);
lblbank.setFont(new
Font("Serif",Font.BOLD,20));
background.add(lblbank);

txtbank = new JTextField(10);
txtbank.setBounds(350,300,100,30);
txtbank.setBackground(Color.white);
background.add(txtbank);

//BANCH NAME
lblbranch = new JLabel("Branch name: ");
lblbranch.setBounds(200,350,150,30);
lblbranch.setForeground(Color.cyan);
lblbranch.setBackground(Color.white);
lblbranch.setFont(new
Font("Serif",Font.BOLD,20));
background.add(lblbranch);

txtbranch = new JTextField(10);
txtbranch.setBounds(350,350,100,30);

Page 63

txtbranch.setBackground(Color.white);
background.add(txtbranch);

//IFSC CODE
lblifsc = new JLabel("IFSC code: ");
lblifsc.setBounds(200,400,150,30);
lblifsc.setForeground(Color.cyan);
lblifsc.setBackground(Color.white);
lblifsc.setFont(new
Font("Serif",Font.BOLD,20));
background.add(lblifsc);

txtifsc = new JTextField(10);
txtifsc.setBounds(350,400,100,30);
txtifsc.setBackground(Color.white);
background.add(txtifsc);

//ACCOUNT NUMBER
lblacnt = new JLabel("Account no.: ");
lblacnt.setBounds(200,450,150,30);
lblacnt.setForeground(Color.cyan);
lblacnt.setBackground(Color.white);
lblacnt.setFont(new
Font("Serif",Font.BOLD,20));
background.add(lblacnt);

txtacnt = new JTextField(10);
txtacnt.setBounds(350,450,100,30);
txtacnt.setBackground(Color.white);
background.add(txtacnt);

Page 64





setVisible(true);

//SUBMIT
submitButton = new JButton("Submit");
submitButton.setBounds(250,500,75,30);
submitButton.setBackground(Color.white);
submitButton.addActionListener(this);
background.add(submitButton);

//BACK
cancelButton = new JButton("Cancel");
cancelButton.setBounds(350,500,80,30);
cancelButton.setBackground(Color.white);
cancelButton.addActionListener(this);
background.add(cancelButton);

setDefaultCloseOperation( EXIT_ON_CLOSE
);
}
public void actionPerformed(ActionEvent event) {
JButton clickedButton = (JButton)
event.getSource();
String buttonText = clickedButton.getText();

if(buttonText.equals("Submit")){

JOptionPane.showMessageDialog(null,"Successfully
entered");
Payment ob = new Payment();

Page 65

ob.setVisible(true);
maf.setVisible(false);



}

if(buttonText.equals("Cancel")){

JOptionPane.showMessageDialog(null,"Cancelled
the booking");
//Home ob = new Home();
//ob.setVisible(true);
//maf.setVisible(false);
}


}


}

Output:

Page 66


Payment
Source Code:
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;


public class Payment extends JFrame implements
ActionListener {

private static Payment maf;
private JLabel lblName,lbldate,lblcvv,lblcard,lblyr;
private JTextField txtName,txtdate,txtcard;

Page 67

private JButton submitButton, cancelButton;
private JPasswordField txtcvv;
public Payment(){


setSize(800,600);
setTitle("Payment details");
setLocation(50,50);


ImageIcon background_image = new
ImageIcon("Payment.jpg");
Image img = background_image.getImage();
Image temp_img =
img.getScaledInstance(800,600,Image.SCALE_SMOOTH);
background_image = new
ImageIcon(temp_img);
JLabel background = new
JLabel("",background_image,JLabel.CENTER);
background.setBounds(0,0,800,600);
add(background);

//NAME
lblName = new JLabel("Card holder: ");
lblName.setBounds(200,50,150,30);
lblName.setBackground(Color.white);
lblName.setForeground(Color.blue);
lblName.setFont(new
Font("Serif",Font.BOLD,20));
background.add(lblName);

txtName = new JTextField(10);
txtName.setBounds(400,50,100,30);

Page 68

txtName.setBackground(Color.white);
background.add(txtName);

//CARD NUMBER
lblcard = new JLabel("Card number: ");
lblcard.setBounds(200,100,150,30);
lblcard.setForeground(Color.white);
lblcard.setForeground(Color.blue);
lblcard.setFont(new
Font("Serif",Font.BOLD,20));
background.add(lblcard);

txtcard = new JTextField(10);
txtcard.setBounds(400,100,100,30);
txtcard.setBackground(Color.white);
background.add(txtcard);

//EXPIRY DATE
lbldate = new JLabel("Expiry month: ");
lbldate.setBounds(200,150,150,30);
lbldate.setForeground(Color.blue);
lbldate.setBackground(Color.white);
lbldate.setFont(new
Font("Serif",Font.BOLD,20));
background.add(lbldate);

String mon[]={"01 (Jan)","02 (Feb)","03
(Mar)","04 (Apr)","05 (May)","06 (Jun)","07 (Jul)","08
(Aug)","09 (Sep)","10 (Oct)","11 (Nov)","12 (Dec)"};
JComboBox txtdate = new JComboBox(mon);
txtdate.setBounds(400,150,100,30);
txtdate.setBackground(Color.white);
background.add(txtdate);

Page 69


lblyr = new JLabel("Expiry Year: ");
lblyr.setBounds(200,200,150,30);
lblyr.setForeground(Color.blue);
lblyr.setBackground(Color.white);
lblyr.setFont(new
Font("Serif",Font.BOLD,20));
background.add(lblyr);

String
yr[]={"2021","2022","2023","2024","2025","2026","2027","2028","2
029","2030","2031","2032","2033","2034","2035","2036"};
JComboBox txtyr = new JComboBox(yr);
txtyr.setBounds(400,200,100,30);
txtyr.setBackground(Color.white);
background.add(txtyr);

//CVV
lblcvv = new JLabel("Enter CVV: ");
lblcvv.setBounds(200,250,150,30);
lblcvv.setForeground(Color.blue);
lblcvv.setFont(new
Font("Serif",Font.BOLD,20));
background.add(lblcvv);

txtcvv = new JPasswordField(10);
txtcvv.setEchoChar('*');
txtcvv.setBounds(400,250,100,30);
txtcvv.setBackground(Color.white);
background.add(txtcvv);

Page 70


setVisible(true);

//SUBMIT
submitButton = new JButton("Submit");
submitButton.setBounds(250,300,75,30);
submitButton.setBackground(Color.white);
submitButton.addActionListener(this);
background.add(submitButton);

//BACK
cancelButton = new JButton("Cancel");
cancelButton.setBounds(350,300,80,30);
cancelButton.setBackground(Color.white);
cancelButton.addActionListener(this);
background.add(cancelButton);

setDefaultCloseOperation( EXIT_ON_CLOSE
);
}
public void actionPerformed(ActionEvent event) {
JButton clickedButton = (JButton)
event.getSource();
String buttonText = clickedButton.getText();

if(buttonText.equals("Submit")){

JOptionPane.showMessageDialog(null,"Successfully
Paid");


}

Page 71

if(buttonText.equals("Cancel")){

JOptionPane.showMessageDialog(null,"Cancelled
the booking.money will be refund to the mentioned
account");

}


}


}

Output:

Page 72


Ticket Cancellation
Source code:
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

class ticketCancel extends JFrame implements
ActionListener{
JComboBox day,month,year;

ticketCancel(){
//font
Font f = new Font("Serif",Font.BOLD,40);
Font fn = new Font("Serif",Font.BOLD,20);

//header
JPanel heading;
heading = new JPanel();
heading.setBackground(new Color(0,0,0,60));
heading.setBounds(0,0,900,90);
JLabel name = new JLabel("Ticket Cancel");
name.setForeground(Color.white);
name.setBounds(200,25,400,33);
name.setFont(f);
heading.add(name);

Page 73

JPanel book = new JPanel();
book.setLayout(null);
book.setSize(400,350);
book.setBackground(new Color(0,0,0,80));
book.setBounds(200,90,500,450);

JLabel Num= new JLabel("Enter Your Train
Number");
Num.setBounds(50,50,380,30);
Num.setForeground(new Color(255,105,180));
Num.setFont(fn);
book.add(Num);

JTextField tf=new JTextField(25);
tf.setBounds(50,90,340,30);
tf.setBackground(new Color(255,240,230));
book.add(tf);
tf.addKeyListener(new KeyAdapter(){
public void keyPressed(KeyEvent ke){
String value=tf.getText();
int l=value.length();
if(ke.getKeyChar() >= '0' &&
ke.getKeyChar() <= '9'){
tf.setEditable(true);
}
else{
tf.setEditable(false);
}
}
});


JLabel from= new JLabel("Journey From");

Page 74

from.setBounds(50,120,380,30);
from.setForeground(new Color(255,105,180));
from.setFont(fn);
book.add(from);

JTextField Name= new JTextField();
Name.setBounds(50,150,340,30);
Name.setBackground(new
Color(255,240,230));
book.add(Name);

JLabel to= new JLabel("Journey To");
to.setBounds(50,190,380,30);
to.setForeground(new Color(255,105,180));
to.setFont(fn);
book.add(to);

JTextField Name2= new JTextField();
Name2.setBounds(50,220,340,30);
Name2.setBackground(new
Color(255,240,230));
book.add(Name2);

JLabel cls=new JLabel("Class");
cls.setBounds(50,260,380,30);
cls.setForeground(new Color(255,105,180));
cls.setFont(fn);
book.add(cls);

String cls1[]={"AC First Class","AC 2 Tier","First
Class","AC 3 Tier","AC Chair Car","Sleeper","Second
Sitting","Exec. Chair Car"};
JComboBox cm= new JComboBox(cls1);

Page 75

cm.setBounds(50,300,340,30);
cm.setBackground(new Color(255,240,230));
book.add(cm);

JLabel date=new JLabel("Date of Journey");
date.setBounds(50,330,200,30);
date.setForeground(new Color(255,105,180));
date.setFont(fn);
book.add(date);

DateFormat dateFormat = new
SimpleDateFormat("dd MMM YYYY");
JFormattedTextField today = new
JFormattedTextField(dateFormat);
today.setName("Today");
today.setColumns(10);
today.setBounds(50,370,340,30);
today.setBackground(new Color(255,240,230));
today.setEditable(true);
today.setValue(new Date());
book.add(today);

JButton np = new JButton("Next Page");
np.setBounds(130,410,180,30);
np.setBackground(new Color(0,206,209));
np.addActionListener(this);
book.add(np);


//frame
setSize(900,600);
setLayout(null);

Page 76

setDefaultCloseOperation( EXIT_ON_CLOSE
);
//background
ImageIcon background_image = new
ImageIcon("homerail.jpg");
Image img = background_image.getImage();
Image temp_img =
img.getScaledInstance(900,600,Image.SCALE_SMOOTH);
background_image = new
ImageIcon(temp_img);
JLabel background = new
JLabel("",background_image,JLabel.CENTER);

background.add(book);
background.add(heading);
background.setBounds(0,0,900,600);
add(background);
setVisible(true);
}


public void actionPerformed(ActionEvent event) {
JButton clickedButton = (JButton)
event.getSource();
String buttonText = clickedButton.getText();

if(buttonText.equals("Next Page")){

JOptionPane.showMessageDialog(null,"Next to the
Passenger Information Page");
psInfo ob = new psInfo();
ob.setVisible(true);
this.setVisible(false);

Page 77

}

}
}
Output:


PNR Status
Source Code:
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

class pnr extends JFrame implements ActionListener{

Page 78


pnr(){

//font
Font f = new Font("Serif",Font.BOLD,40);
Font fn = new Font("Serif",Font.BOLD,20);
//header
JPanel heading;
heading = new JPanel();
heading.setBackground(new Color(0,0,0,60));
heading.setBounds(0,0,900,90);
JLabel name = new JLabel("Passenger Current
Status");
name.setForeground(Color.white);
name.setBounds(200,25,400,35);
name.setFont(f);
heading.add(name);
//pnr panel
JPanel Pnr = new JPanel();
Pnr.setLayout(null);
Pnr.setSize(400,350);
Pnr.setBackground(new Color(0,0,0,80));
Pnr.setBounds(200,175,500,180);

JLabel Num= new JLabel("Enter Your PNR
Number");
Num.setBounds(50,50,380,30);
Num.setForeground(new Color(240,128,128));
Num.setFont(fn);
Pnr.add(Num);

JTextField tf=new JTextField(25);
tf.setBounds(50,90,340,30);

Page 79

tf.setBackground(new Color(210,180,140));
Pnr.add(tf);
tf.addKeyListener(new KeyAdapter(){
public void keyPressed(KeyEvent ke){
String value=tf.getText();
int l=value.length();
if(ke.getKeyChar() >= '0' &&
ke.getKeyChar() <= '9'){
tf.setEditable(true);
}
else{
tf.setEditable(false);
}
}
});


JButton signup = new JButton("Get Status");
signup.setBounds(100,140,100,30);
signup.setBackground(new Color(160,182,45));
Pnr.add(signup);
signup.addActionListener(this);


JButton br = new JButton("Back");
br.setBounds(250,140,100,30);
br.setBackground(new Color(160,182,45));
Pnr.add(br);
br.addActionListener(this);


//frame
setSize(900,600);

Page 80

setLayout(null);
setDefaultCloseOperation( EXIT_ON_CLOSE
);
//background
ImageIcon background_image = new
ImageIcon("home.jpg");
Image img = background_image.getImage();
Image temp_img =
img.getScaledInstance(900,600,Image.SCALE_SMOOTH);
background_image = new
ImageIcon(temp_img);
JLabel background = new
JLabel("",background_image,JLabel.CENTER);

background.add(Pnr);
background.add(heading);
background.setBounds(0,0,900,600);
add(background);
setVisible(true);
}


public void actionPerformed(ActionEvent
event) {
JButton clickedButton = (JButton)
event.getSource();
String buttonText = clickedButton.getText();

if(buttonText.equals("Get Status")){

JOptionPane.showMessageDialog(null,"Confirmed")
;
}

Page 81

else
{

JOptionPane.showMessageDialog(null,"Back to log
in page");
log_in ob = new log_in();
ob.setVisible(true);
this.setVisible(false);
}

}
}
Output:

Page 82

ASSIGNMENT 06
Test Case Design (Login Page)
Sl. No. Test Case
ID
Do Expected
Result
01. QT1-001 Enter username
in the text box
specified.
Username must
not be more than
10 characters and
it should not
contain any
special
characters and
no spaces
including in the
start. All
character is in
lowercase.
Enter password
in the text box
specified.
Password must
not be more than
10 characters.
Click on the Sign
in button. Successful
login in the
system if
the values
are found in
the
database.
And open
Home page.
02. QT2-001 Click on the Sign
up button.
Successfully
open Registration
page.

Page 83


Test Report (Login Page)
Function Purpose of
set of test
cases per
area
Test case
ID’s
No. of
Test cases run

Number
of Test cases
Sign in The
verification
of
username
and
password
QT1-001 8 100%
Link Open
another web page.
QT1-002 8 100%
Link Open
another web page.
QT1-003 8 100%
Sign up Safely open
Registration page.
QT2-001 8 100%

Test Case Design (Registration Page)
Sl. No. Test Case
ID
Do Expected
Result
01. QT1-001 Enter name in
the text box
Successful
register in

Page 84

specified. Name
must not be
more than 10
characters and it
should not
contain any
special
characters. Enter
password in the
text box
specified.
Password must
not be more than
10 characters.
Enter mobile
number in the
text box
specified. Mobile
number must
contain only
number. Enter
email id in text
box which
should contain
special
characters and
number and
letters. And
select gender
field. And enter
address in the
text box.
Click on the Sign

the system
if the
values are
found in
the
database.
And open
Home page.

Page 85

Up button.
02. QT2-001 Click on the back
button.
Successfully
back to the
Login page.

Test Report (Registration Page)
Function Purpose of
set of test
cases per
area
Test case
ID’s
No. of
Test cases run

Number
of Test cases
Sign Up The
Registration of user in the system
QT1-001 8 100%
Link Open
another
web page.
QT1-002 8 100%
Link Open
another
web page.
QT1-003 8 100%
Back Back to
Login page.
QT2-001 8 100%

Test Case Design (Home Page)
Sl. No. Test Case
ID
Do Expected
Result

Page 86

01. QT1-001 Click on the
BOOK TICKET
button.
Successfully
open Ticket
Booking
page.
02. QT1-002 Click on the
CANCEL button.
Successfully
open Ticket
Cancel
page.
03.

QT1-003

Click on the
SEARCH TRAIN
button.

Successfully
open
Search train
page.

04. QT1-004

Click on the PNR
button.

Successfully
open Pnr
status page.

05. QT1-005

Click on the log
out button.

Successfully
back to Login page.


Test Report (Home Page)
Function Purpose of
set of test
cases per
area
Test case
ID’s
No. of
Test cases run
Number
of Test cases
Link Open
another
web page.
QT1-006 7 100%

Page 87

Link Open
another
web page.
QT1-007 7 100%
Link Open
another
web page.
QT1-008 7 100%
Link Open
another
web page.
QT1-009 7 100%
Log out Back to
Login page.
QT1-005 7 100%

Test Case Design (Search Train Page)
Sl. No. Test Case
ID
Do Expected
Result
01. QT1-001 Select “From”
comboBox for
choosing station.
And select “To”
comboBox for
choosing station.
Enter date of
journey in the
date field. Date
of journey
should be always
in date pattern.
And select
“Class”
comboBox for
choosing class.
Successfully
search the
train details if the values are found in database.

Page 88

Click on the
Search button.

Test Report (Search Train Page)
Function Purpose of
set of test
cases per
area
Test case
ID’s
No. of
Test
cases run
Number
of Test cases
Search Search
train
details.
QT1-001 7 100%

Test Case Design (Ticket Booking Page)
Sl. No. Test Case
ID
Do Expected
Result
01. QT1-001 Enter train
number to the
text field which
must contain
only number.
Enter Journey
From text field
and Journey To
text field which
contain only
letter. Select
“Class”
comboBox and
Successfully
open Passenger Information Page.

Page 89

enter date of
journey which
must be in date
pattern.
Click on the Next
Page button.

Test Report (Ticket Booking Page)
Function Purpose of
set of test
cases per
area
Test case
ID’s
No. of
Test
cases run
Number
of Test cases
Next Page Enter all
necessary
field for
ticket
booking.
QT1-001 10 100%
Link Open
another web page.

QT1-002 10 100%

Test Case Design (Passenger Information Page)
Sl. No. Test Case
ID
Do Expected
Result
01. QT1-001 Enter name in
the text box
specified. Name
must not be
more than 10
Ticket
booking form submit successfully

Page 90

characters and it
should not
contain any
special
characters. Enter
password in the
text box
specified. Enter
mobile number
in the text box
specified. Mobile
number must
contain only
number. Enter
email id in text
box which
should contain
special
characters and
number and
letters. And
select gender
field. And enter
address in the
text box. Enter
bank name and
branch name.
And enter IFSC
code which must
contain number
and letter. And
enter account no
which contain
and open
Payment page.

Page 91

only number.
Click on the
Submit button.
02. QT2-001 Click on the
Cancel button.
Successfully
cancel
ticket and
back to the
home page.

Test Report (Passenger Information Page)
Function Purpose of
set of test
cases per
area
Test case
ID’s
No. of
Test
cases run
Number
of Test cases
Submit Enter all
necessary
field for ticket book.
QT1-001 10 100%
Link Open
another web page.

QT1-002 10 100%
Link Open
another web page.

QT1-003 10 100%
Cancel


Enter all
necessary
field for
ticket
cancel.

QT2-001 10 100%

Page 92



Test Case Design (Payment Page)
Sl. No. Test Case
ID
Do Expected
Result
01. QT1-001 Enter card
holder name in
the text box
specified. Name
must not be
more than 10
characters and it
should not
contain any
special
characters. Enter
card number in
the text box
specified. Card
number must
contain only
number. And
select “expiry
month” and
“expiry year”
field. And enter Payment
submit
successfully
and open
Payment
page.

Page 93

CVV no which
contain only 3
digit number.
Click on the
Submit button.
02. QT2-001 Click on the
Cancel button.
Successfully
cancel
ticket and
refund
money.

Test Report (Payment Page)
Function Purpose of
set of test
cases per
area
Test case
ID’s
No. of
Test
cases run
Number
of Test cases
Submit Enter all
necessary
field for
payment.
QT1-001 7 100%
Cancel Cancel
ticket and refund money.

QT2-001 7 100%

Test Case Design (Ticket Cancel Page)
Sl. No. Test Case
ID
Do Expected
Result

Page 94

01. QT1-001 Enter train
number to the
text field which
must contain
only number.
Enter Journey
From text field
and Journey To
text field which
contain only
letter. Select
“Class”
comboBox and
enter date of
journey which
must be in date
pattern.
Click on the Next
Page button.
Successfully
open Passenger Information Page.

Test Report (Ticket Cancel Page)
Function Purpose of
set of test
cases per
area
Test case
ID’s
No. of
Test cases run
Number
of Test cases
Next Page Enter all
necessary
field for
ticket
cancel.
QT1-001 10 100%

Page 95

Link Open
another
web page.
QT1-002 10 100%

Test Case Design (PNR Status Page)
Sl. No. Test Case
ID
Do Expected
Result
01. QT1-001 Enter PNR
number to the
text field which
must contain
only number.
Click on the Get
Status button.
Successfully
show PNR
Status if the
values are found in database.
02. QT2-001 Click on the Back
button.

Successfully
back to Login page.



Test Report (PNR Status Page)
Function Purpose of
set of test
cases per
area
Test case
ID’s
No. of
Test
cases run
Number
of Test cases
Get
Status
Enter PNR
number for getting status.
QT1-001 9 100%

Page 96

Link Open
another
web page.
QT1-002 9 100%
Back Back to
Login page.
QT2-001 9 100%

Page 97





Thank You