Railway Akhil Aditya 2013
Railway Akhil Aditya 2013
submitted to
Step by Step High School
3, Chitrakoot Scheme
JAIPUR
in partial fulfillment
of the requirements for
Akhil Goel
Acknowledgement
We would like to thank everyone who helped me to accomplish this project.
Our sincere thanks to our family members and respected teachers, who have
helped us with their valuable suggestions and support throughout the
development of the project.
We are highly thankful to our project guide Ms. Shakuntala for providing
guidance and support at every stage of the project.
Akhil Goel
&
Aditya Joshi
CERTIFICATE OF ORIGINALITY
This is to certify that the project report entitled Railway Project submitted to
STEP
BY
.....
Signature of the Guide
Date:
Name: Ms. Shakuntala
HOD - Computer
STEP BY STEP HIGH SCHOOL
Jaipur
Contents
S#
Topic
Page#
Problem Definition
20
Data Dictionary
43
Scope
This is a mini project on Railway Reservation System.
Further, it can be easily customized for the use of any other travel agency etc.
This project will help them to create a working system into the latest concept of
paperless office.
Problem Definition
The following case study is to be adopted for the development of project.
The project should provide facility to add/modify the following records:
Train related information
Fare related information
PNR number entries
The project should facilitate the following details on screen:
Ticket Status
Fare Information All and a particular Train both
Train Information
As a developer you are required to design the project and develop it as per
customer needs.
Suitable assumptions can be made during implementation. A proper normalized
database is to be maintained in the RDBMS and the front end is to be developed
using advanced interface controls. User-friendly interface is to be generated.
Windows 7
Tools
RDBMS
MySQL
Hardware Specifications
Microprocessor(CPU)
Dual Core
Memory (RAM)
4 GB
Virtual Memory
32-bit
Hard Disk
500 GB
VDU
SVGA
Keyboard
Mouse
Printer
Inkjet / Laser
Operating System
Windows 7
Front-End Design
Back-End
MySQL
Documentation
Software Specifications
INPUT
FORMS
10
11
12
13
14
15
16
17
18
19
20
21
22
Source
Code
23
private void
passengerActionPerformed(java.awt.event.ActionEvent evt) {
new main().setVisible(true);
}
private void
adminActionPerformed(java.awt.event.ActionEvent evt) {
new password().setVisible(true);
}
import javax.swing.JOptionPane;
private void
jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
this.dispose();
}
24
25
26
private void
jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
new train_information().setVisible(true);
}
private void
jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
new parttrain().setVisible(true);
}
private void jMenu2MouseClicked(java.awt.event.MouseEvent
evt) {
// TODO add your handling code here:
new TcketStatus().setVisible(true);
}
private void jMenu5MouseClicked(java.awt.event.MouseEvent
evt) {
//Code for exit button
System.exit(0);
}
private void jMenu4MouseClicked(java.awt.event.MouseEvent
evt) {
// TODO add your handling code here:
new about().setVisible(true);
}
27
import java.sql.*;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
public train_information() {
initComponents();
try
{
Class.forName("java.sql.DriverManager");
Connection con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/infor
mation","root","");
Statement st = con.createStatement();
String sql = "SELECT * FROM RAILWAY";
ResultSet rs = st.executeQuery(sql);
DefaultTableModel model = (DefaultTableModel)
jTable1.getModel();
int rows = model.getRowCount();
if(rows>0)
{
for(int i = 0; i<rows;i++)
model.removeRow(0);
}
while(rs.next())
{
model.addRow(new Object[]
{rs.getString(1),rs.getString(2),
28
import
import
import
public
java.sql.*;
javax.swing.DefaultComboBoxModel;
javax.swing.JOptionPane;
parttrain() {
initComponents();
try
{
Class.forName("java.sql.DriverManager");
29
30
}
private void
jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
this.dispose();
}
31
import
import
double
public
javax.swing.JOptionPane;
java.sql.*;
b = TcketStatus.a;
pnrstat() {
initComponents();
txtpnr.setText(""+b);
try
{
Class.forName("java.sql.DriverManager");
Connection con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/infor
mation","root","");
Statement st = con.createStatement();
String pnrno1 = txtpnr.getText();
String sql = "SELECT * FROM PNR WHERE
PNR_NO="+pnrno1;
ResultSet rs = st.executeQuery(sql);
rs.next();
String a,b,c,d,e,f,g;
a=rs.getString(3);
b=rs.getString(1);
c=rs.getString(2);
d=rs.getString(13);
e=rs.getString(14);
f=rs.getString(15);
g=rs.getString(4);
txtpnr.setText(a);
txttrno.setText(b);
txttrname.setText(c);
Submitted by Akhil Goel & Aditya Joshi
32
import javax.swing.JOptionPane;
import java.sql.*;
import java.util.Random;
private String Trname;
private String origin;
private String dept;
private long l;
public pnrentry() {
initComponents();
txtage1.setVisible(false);
combogen1.setVisible(false);
txtage2.setVisible(false);
combogen2.setVisible(false);
Submitted by Akhil Goel & Aditya Joshi
33
34
35
36
import javax.swing.JOptionPane;
import java.sql.*;
private void
jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
try
{
Class.forName("java.sql.DriverManager");
Connection con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/infor
mation","root","");
Statement st = con.createStatement();
Submitted by Akhil Goel & Aditya Joshi
37
38
39
40
41
import java.sql.*;
import javax.swing.JOptionPane;
private void
jButton6ActionPerformed(java.awt.event.ActionEvent evt) {
this.dispose();
}
private void
jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
try {
Class.forName("java.sql.DriverManager");
Connection con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/infor
mation", "root", "");
String
no1,name1,or1,deptime1,dest1,arrtime1,daysrun1;
no1 = no.getText();
name1 = name.getText();
or1 = or.getText();
deptime1 = depttime.getText();
dest1 = dest.getText();
arrtime1 = arrtime.getText();
daysrun1 = daysrun.getText();
Statement st = con.createStatement();
42
import java.sql.*;
import javax.swing.JOptionPane;
43
44
}
}
import java.sql.*;
import javax.swing.JOptionPane;
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt)
{
try{
Class.forName("java.sql.DriverManager");
Connection con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/information
","root","");
Statement st = con.createStatement();
String trno = txttrno.getText();
String sql = "DELETE FROM RAILWAY WHERE
TrainNo="+trno;
JOptionPane.showConfirmDialog(this,"Do You Really
Want to Cancel this Ticket?");
if(JOptionPane.YES_OPTION==0)
{
st.executeUpdate(sql);
JOptionPane.showMessageDialog(this,"Ticket Cancelled");
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,e.getMessage());
}
45
Data Dictionary
Various tables used in this project are as follows:
S#
Table Name
Uses
RAILWAY
PNR
RAILWAY
Data Name
Data Type
Size
TR_NO
Numeric
TR_NAME
Varchar
20
ORIGIN
Varchar
20
DEP_TIME
Numeric
5,2
DESTINATIO
N
Varchar
20
ARR_TIME
Numeric
5,2
DAYS_RUN
Varchar
30
PNR
Size
Data Name
Data Type
PNRNO
Numeric
NAME
Varchar
25
POSITION
Varchar
25
Remarks
Primary Key
Remarks
Primary Key
46
47