SlideShare ist ein Scribd-Unternehmen logo
1 von 20
Downloaden Sie, um offline zu lesen
PROJECT REPORT
RAILWAY
RESERVATION
SYSTEM
2015-16
Faculty concern By.
Dr. Harikesh Singh Prashant Sharma
CSE Dept. 131042
ECE A2
TABLE OF CONTENTS
S.No Topic Page No.
1. Main Frame 3
2. Check Train
Schedule Frame
5
3. Check Seat
Availability
Frame
8
4. Book Ticket
Frame
11
5. Check Ticket
Frame
15
6. Cancel Ticket
Frame
17
7. How to create a
SQL file
19
8. How to use a SQL
file
20
MAIN FRAME
CODE:
//code for radio button check train schedule
Trainbtwstations a=new Trainbtwstations();
a.setVisible(true);
//code for radio button book ticket
Book d=new Book();
d.setVisible(true);
//code for radio button check availiability
Checkavailability e=new Checkavailability();
e.setVisible(true);
//code for radio button check your ticket
CheckTicket a=new CheckTicket();
a.setVisible(true);
//code for radio button cancel your ticket
Cancel b=new Cancel();
b.setVisible(true);
//code for exit button
System.exit(0);
CHECK TRAIN SCHEDULE FRAME
CODE:
IMPORT FILES:
import java.sql.*;
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.ResultSet;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
CODE FOR CHECK TRAIN BUTTON
String start=(String)classs1.getSelectedItem();
String fin=(String)classs2.getSelectedItem();
if (start.isEmpty())
{
JOptionPane.showMessageDialog(this,"Enter the Starting destination");
}
if (fin.isEmpty())
{
JOptionPane.showMessageDialog(this,"Enter the final destination");
}
else
{
DefaultTableModel model=(DefaultTableModel) tab1.getModel();
Connection con=null;
try {
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/railway","root","root");
if(con!=null){
Statement stmt =con.createStatement();
//String query="SELECT * from trainbtw where (source = '"+start+"' and des =
'"+fin+"');";
ResultSet rs=stmt.executeQuery("SELECT * from trainbtw where (source = '"+start+"' and
des = '"+fin+"');");
while (rs.next())
{
int tn = rs.getInt("tno");
String tname = rs.getString("tname");
String strt = rs.getString("source");
String fnl = rs.getString("des");
model.addRow(new Object[]{tn,tname,strt,fnl});
}
}
}
catch (Exception e)
{
JOptionPane.showMessageDialog(null, "error in connectivity");
}
}
}
CODE FOR HOME BUTTON
OnlineReservation b=new OnlineReservation();
b.setVisible(false);
CODE FOR NEXT BUTTON
Checkavailability b=new Checkavailability();
b.setVisible(true);
CHECK SEAT AVAILABILITY FRAME
CODE:
IMPORT FILES:
import java.sql.*;
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.ResultSet;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel
CODE FOR CHECK AVAILABILITY BUTTON
String tno=t1.getText();
DefaultTableModel model=(DefaultTableModel)tab1.getModel();
Connection con=null;
try{
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/railway","root","root");
Statement stmt=con.createStatement();
//String query="select * from avail where TableNo='"+tno+"' ;";
ResultSet rs=stmt.executeQuery("select * from avail where TrainNo='"+tno+"' ;");
while(rs.next()){
String tn=rs.getString("TrainNo");
String tname=rs.getString("TrainName");
String fac=rs.getString("FirstAC");
String sac=rs.getString("SecondAC");
String tac=rs.getString("ThirdAC");
String sle=rs.getString("Sleeper");
model.addRow(new Object[]{tn,tname,fac,sac,tac,sle});
}
}
catch(Exception e){
JOptionPane.showMessageDialog(rootPane, "error");
}
CODE FOR GET TICKET BUTTON
Book h=new Book();
h.setVisible(true);
CODE FOR BACK BUTTON
Trainbtwstations b=new Trainbtwstations();
b.setVisible(true);
CODE FOR HOME BUTTON
OnlineReservation b=new OnlineReservation();
b.setVisible(true);
CODE FOR COMBO BOX
if(c1.getSelectedIndex()==0)
t1.setText("" +3245);
else
if(c1.getSelectedIndex()==1)
t1.setText("" +2345);
else
if(c1.getSelectedIndex()==2)
t1.setText("" +2931);
else
if(c1.getSelectedIndex()==3)
t1.setText("" +8412);
else
if(c1.getSelectedIndex()==4)
t1.setText("" +3429);
else
if(c1.getSelectedIndex()==5)
t1.setText("" +7103);
BOOK TICKET FRAME
CODE:
IMPORT FILES:
import java.sql.*;
import java.sql.DriverManager;
import java.sql.Statement;
import javax.swing.JOptionPane;
CODE FOR SUBMIT BUTTON
String tno=t2.getText();
String tname=(String)c2.getSelectedItem();
String source=(String)classs1.getSelectedItem();
String des=(String)classs2.getSelectedItem();
String name=t5.getText();
String cla=(String)classs.getSelectedItem();
String age=t7.getText();
String contact=t6.getText();
String sex="";
if(Male.isSelected()){
sex="Male";
}
else
if(Female.isSelected()){
sex="Female";
}
else if(other.isSelected()){
sex="Other";
}
String date=t1.getText();
Connection con=null;
try{
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/railway","root","root");
if(con!=null){
Statement stmt=con.createStatement();
int pnr=100000;
ResultSet rs=stmt.executeQuery("select pnr from book order by pnr desc limit 1");
while(rs.next()){
pnr=rs.getInt("pnr");
}
pnr++;
String query="insert into book
values("+pnr+","+tno+",'"+tname+"','"+source+"','"+des+"','"+cla+"','"+name+"',"+contact+",
"+age+",'"+sex+"','"+date+"')";
int r=stmt.executeUpdate(query);
if(r!=0){
ResultSet rs1=stmt.executeQuery("select "+cla+" from avail where TrainNo="+tno);
int no_seat=0;
while(rs1.next()){
no_seat=rs1.getInt(1);
}
no_seat--;
int r1=stmt.executeUpdate("update avail set "+cla+"="+no_seat+" where
TrainNo="+tno);
JOptionPane.showMessageDialog(rootPane, "Your pnr : "+pnr);
if(r1!=0){
this.dispose();
new OnlineReservation().setVisible(true);
}
}
else{
JOptionPane.showMessageDialog(rootPane, "booking not Possible / worng credentials:
");
}
}
else{
JOptionPane.showMessageDialog(rootPane, "connection error ");
}
}
catch(Exception e)
{
System.out.println(e);
//JOptionPane.showMessageDialog(rootPane, "ERROR");
} }
CODE FOR COMBO BOX
if(c2.getSelectedIndex()==0)
t2.setText("" +0000);
else
if(c2.getSelectedIndex()==1)
t2.setText("" +3245);
else
if(c2.getSelectedIndex()==2)
t2.setText("" +2345);
else
if(c2.getSelectedIndex()==3)
t2.setText("" +2931);
else
if(c2.getSelectedIndex()==4)
t2.setText("" +8412);
else
if(c2.getSelectedIndex()==5)
t2.setText("" +3429);
else
if(c2.getSelectedIndex()==6)
t2.setText("" +7103);
CODE FOR BACK BUTTON
Checkavailability b=new Checkavailability();
b.setVisible(true);
CODE FOR HOME BUTTON
OnlineReservation b=new OnlineReservation();
b.setVisible(true);
CHECK TICKET FRAME
CODE:
IMPORT FILES:
import java.sql.*;
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.ResultSet;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
CODE FOR CHECK BUTTON
String n=t1.getText();
String a=t2.getText();
DefaultTableModel model=(DefaultTableModel) tab1.getModel();
Connection con=null;
try{
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/railway","root","root");
if(con!=null){
Statement stmt=con.createStatement();
ResultSet rs=stmt.executeQuery("SELECT pnr,tno,tname,class,name,age from book where
(pnr = "+n+" and name = '"+a+"');");
if(rs.next())
{ String po=rs.getString("pnr");
String to=rs.getString("tno");
String tn=rs.getString("tname");
String cl=rs.getString("class");
String na=rs.getString("name");
String ag=rs.getString("age");
model.addRow(new Object[]{to,po,na,ag,tn,cl});
} else
{
JOptionPane.showMessageDialog(rootPane,"PNR or Name is wrong");
}
}
}
catch(Exception e){
JOptionPane.showMessageDialog(rootPane, "error");
}
CODE FOR HOME BUTTON
OnlineReservation b=new OnlineReservation();
b.setVisible(true);
CODE FOR CONFIRM BUTTON
d1.setVisible(true);
CANCEL TICKET FRAME
CODE:
IMPORT FILES:
import java.sql.*;
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
CODE FOR CANCEL YOUR TICKET BUTTON
String a=t1.getText();
String name=t2.getText();
String cla=(String)classs2.getSelectedItem();
String tno=t3.getText();
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection
("jdbc:mysql://localhost:3306/railway","root","root");
Statement stmt=con.createStatement();
//String query="delete from book where pnr='"+a+"' and name='"+name+"';";
int r=stmt.executeUpdate("delete from book where pnr='"+a+"';");
if(r!=0){
ResultSet rs1=stmt.executeQuery("select "+cla+" from avail where TrainNo="+tno);
int no_seat=0;
while(rs1.next()){
no_seat=rs1.getInt(1);
}
no_seat++;
int r1=stmt.executeUpdate("update avail set "+cla+"="+no_seat+" where
TrainNo="+tno);
d3.setVisible(true);
}
else
{
d2.setVisible(true);
}
}
catch(ClassNotFoundException e)
{
JOptionPane.showMessageDialog(rootPane, "ERROR");
} catch (SQLException e) {
JOptionPane.showMessageDialog(rootPane, "ERROR");
}
CODE FOR HOME BUTTON
OnlineReservation b=new OnlineReservation();
b.setVisible(true);
HOW TO CREATA A SQL FILE OF A
DATABASE FROM COMMAND PROMPT
This is the procedure to create a sql file from a database in mysql:
1. Open command prompt in admin mode.
2.Now change directory to the bin directory of the mysql.
3.Now type the below command in the command prompt and then enter the password of your
mysql.
4.Press enter and now you can find your database sql file in the bin folder of mysql.
HOW TO USE A SQL FILE FROM COMMAND
PROMPT IN ANOTHER PC
Procedure:
1.Open mysql and create database (give any name);
2.Now type command use “databasename”;
3.Now paste the .sql file in your bin folder of mysql.
4.Now open command prompt and change the directory to the bin directory of mysql.
5. now type the command as shown below

Weitere ähnliche Inhalte

Was ist angesagt?

Documentation of railway reservation system
Documentation of railway reservation systemDocumentation of railway reservation system
Documentation of railway reservation system
Sandip Murari
 
Online Airline Ticket reservation System
Online Airline Ticket reservation SystemOnline Airline Ticket reservation System
Online Airline Ticket reservation System
sathyakawthar
 
Presentation on Railway Reservation System
Presentation on Railway Reservation SystemPresentation on Railway Reservation System
Presentation on Railway Reservation System
Priyanka Sharma
 

Was ist angesagt? (20)

Airline Reservation System - Software Engineering
Airline Reservation System - Software EngineeringAirline Reservation System - Software Engineering
Airline Reservation System - Software Engineering
 
us reservation System Report
us reservation System Reportus reservation System Report
us reservation System Report
 
Railway Reservation system
Railway Reservation systemRailway Reservation system
Railway Reservation system
 
Railway reservation system
Railway reservation systemRailway reservation system
Railway reservation system
 
Online Bus Reservation System
Online Bus Reservation SystemOnline Bus Reservation System
Online Bus Reservation System
 
Railway Reservation system
Railway Reservation systemRailway Reservation system
Railway Reservation system
 
Online travel booikng
Online travel booikngOnline travel booikng
Online travel booikng
 
Synopsis on railway reservation system
Synopsis on railway reservation systemSynopsis on railway reservation system
Synopsis on railway reservation system
 
Presentation of Turbo C++ || Railway Reservation System project || B.Sc. student
Presentation of Turbo C++ || Railway Reservation System project || B.Sc. studentPresentation of Turbo C++ || Railway Reservation System project || B.Sc. student
Presentation of Turbo C++ || Railway Reservation System project || B.Sc. student
 
Documentation of railway reservation system
Documentation of railway reservation systemDocumentation of railway reservation system
Documentation of railway reservation system
 
Online Movie ticket booking Project
Online Movie ticket booking ProjectOnline Movie ticket booking Project
Online Movie ticket booking Project
 
Indian railway reservation problems rsdo report file
Indian railway reservation problems rsdo report fileIndian railway reservation problems rsdo report file
Indian railway reservation problems rsdo report file
 
Online railway reservation system
Online railway reservation systemOnline railway reservation system
Online railway reservation system
 
Online Bus ticket reservation
Online Bus ticket reservationOnline Bus ticket reservation
Online Bus ticket reservation
 
Airline Reservation system(project report of six week training)-ppt
Airline Reservation system(project report of six week training)-pptAirline Reservation system(project report of six week training)-ppt
Airline Reservation system(project report of six week training)-ppt
 
ER diagrams for Railway reservation system
ER diagrams for Railway reservation systemER diagrams for Railway reservation system
ER diagrams for Railway reservation system
 
Railway reservation system
Railway reservation systemRailway reservation system
Railway reservation system
 
Online Airline Ticket reservation System
Online Airline Ticket reservation SystemOnline Airline Ticket reservation System
Online Airline Ticket reservation System
 
Bus management system
Bus management systemBus management system
Bus management system
 
Presentation on Railway Reservation System
Presentation on Railway Reservation SystemPresentation on Railway Reservation System
Presentation on Railway Reservation System
 

Andere mochten auch

ECE 24 Final Report 052209
ECE 24 Final Report 052209ECE 24 Final Report 052209
ECE 24 Final Report 052209
crh342
 
finel report on india map project
finel report on india map projectfinel report on india map project
finel report on india map project
Ashish Sharma
 
Railway reservation management by sandip murari
Railway reservation management by sandip murariRailway reservation management by sandip murari
Railway reservation management by sandip murari
Sandip Murari
 
Airline Reservation System - Model Driven Software Engineering Approach
Airline Reservation System - Model Driven Software Engineering ApproachAirline Reservation System - Model Driven Software Engineering Approach
Airline Reservation System - Model Driven Software Engineering Approach
Onkar Kadam
 
Sequential Circuits - Flip Flops (Part 2)
Sequential Circuits - Flip Flops (Part 2)Sequential Circuits - Flip Flops (Part 2)
Sequential Circuits - Flip Flops (Part 2)
Abhilash Nair
 
Introduction to airline reservation systems
Introduction to airline reservation systemsIntroduction to airline reservation systems
Introduction to airline reservation systems
Java and .NET Architect
 

Andere mochten auch (16)

srs for railway reservation system
 srs for railway reservation system srs for railway reservation system
srs for railway reservation system
 
ECE 24 Final Report 052209
ECE 24 Final Report 052209ECE 24 Final Report 052209
ECE 24 Final Report 052209
 
Project report RAILWAY TICKET RESERVATION SYSTEM SAD
Project report RAILWAY TICKET RESERVATION SYSTEM SADProject report RAILWAY TICKET RESERVATION SYSTEM SAD
Project report RAILWAY TICKET RESERVATION SYSTEM SAD
 
Artigo Revista Protecao Julho2015
Artigo Revista Protecao Julho2015Artigo Revista Protecao Julho2015
Artigo Revista Protecao Julho2015
 
[Airline Information System] in Database Project presntation
[Airline Information System] in Database Project presntation[Airline Information System] in Database Project presntation
[Airline Information System] in Database Project presntation
 
Saur lecture 16
Saur lecture 16Saur lecture 16
Saur lecture 16
 
finel report on india map project
finel report on india map projectfinel report on india map project
finel report on india map project
 
Railway reservation management by sandip murari
Railway reservation management by sandip murariRailway reservation management by sandip murari
Railway reservation management by sandip murari
 
Airline Reservation System - Model Driven Software Engineering Approach
Airline Reservation System - Model Driven Software Engineering ApproachAirline Reservation System - Model Driven Software Engineering Approach
Airline Reservation System - Model Driven Software Engineering Approach
 
Railway Ticket Issuing System (Online)
Railway Ticket Issuing System (Online)Railway Ticket Issuing System (Online)
Railway Ticket Issuing System (Online)
 
Synopsis for Online Railway Railway Reservation System
Synopsis for Online Railway Railway Reservation SystemSynopsis for Online Railway Railway Reservation System
Synopsis for Online Railway Railway Reservation System
 
Sequential Circuits - Flip Flops (Part 2)
Sequential Circuits - Flip Flops (Part 2)Sequential Circuits - Flip Flops (Part 2)
Sequential Circuits - Flip Flops (Part 2)
 
The railway ticket service c++ project class 12
The railway ticket service c++ project class 12The railway ticket service c++ project class 12
The railway ticket service c++ project class 12
 
Railway Reservation Documentation
Railway Reservation DocumentationRailway Reservation Documentation
Railway Reservation Documentation
 
Introduction to airline reservation systems
Introduction to airline reservation systemsIntroduction to airline reservation systems
Introduction to airline reservation systems
 
Efectos nocivos de la tecnología informática en el medio ambiente
Efectos nocivos de la tecnología informática en el medio ambienteEfectos nocivos de la tecnología informática en el medio ambiente
Efectos nocivos de la tecnología informática en el medio ambiente
 

Ähnlich wie Railway reservation system

Whats new in_csharp4
Whats new in_csharp4Whats new in_csharp4
Whats new in_csharp4
Abed Bukhari
 
import java-util--- import java-io--- class Vertex { -- Constructo.docx
import java-util--- import java-io---   class Vertex {   -- Constructo.docximport java-util--- import java-io---   class Vertex {   -- Constructo.docx
import java-util--- import java-io--- class Vertex { -- Constructo.docx
Blake0FxCampbelld
 
Create a Flight class that uses the Plane and Time class. This class.pdf
Create a Flight class that uses the Plane and Time class. This class.pdfCreate a Flight class that uses the Plane and Time class. This class.pdf
Create a Flight class that uses the Plane and Time class. This class.pdf
daniamantileonismc36
 
Create a JAVA program that performs file IO and database interaction.pdf
Create a JAVA program that performs file IO and database interaction.pdfCreate a JAVA program that performs file IO and database interaction.pdf
Create a JAVA program that performs file IO and database interaction.pdf
malavshah9013
 
Implement a queue using a linkedlist (java)SolutionLinkedQueue.pdf
Implement a queue using a linkedlist (java)SolutionLinkedQueue.pdfImplement a queue using a linkedlist (java)SolutionLinkedQueue.pdf
Implement a queue using a linkedlist (java)SolutionLinkedQueue.pdf
kostikjaylonshaewe47
 
Executing Sql Commands
Executing Sql CommandsExecuting Sql Commands
Executing Sql Commands
phanleson
 
Executing Sql Commands
Executing Sql CommandsExecuting Sql Commands
Executing Sql Commands
leminhvuong
 
help me Java projectI put problem and my own code in the linkmy .pdf
help me Java projectI put problem and my own code in the linkmy .pdfhelp me Java projectI put problem and my own code in the linkmy .pdf
help me Java projectI put problem and my own code in the linkmy .pdf
arihantmum
 
Embedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for JavaEmbedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for Java
Jevgeni Kabanov
 
Using NetBeansImplement a queue named QueueLL using a Linked List .pdf
Using NetBeansImplement a queue named QueueLL using a Linked List .pdfUsing NetBeansImplement a queue named QueueLL using a Linked List .pdf
Using NetBeansImplement a queue named QueueLL using a Linked List .pdf
siennatimbok52331
 

Ähnlich wie Railway reservation system (20)

Ss
SsSs
Ss
 
Whats new in_csharp4
Whats new in_csharp4Whats new in_csharp4
Whats new in_csharp4
 
5 Rmi Print
5  Rmi Print5  Rmi Print
5 Rmi Print
 
bai giai de LTWINForm.docx
bai giai de LTWINForm.docxbai giai de LTWINForm.docx
bai giai de LTWINForm.docx
 
import java-util--- import java-io--- class Vertex { -- Constructo.docx
import java-util--- import java-io---   class Vertex {   -- Constructo.docximport java-util--- import java-io---   class Vertex {   -- Constructo.docx
import java-util--- import java-io--- class Vertex { -- Constructo.docx
 
Create a Flight class that uses the Plane and Time class. This class.pdf
Create a Flight class that uses the Plane and Time class. This class.pdfCreate a Flight class that uses the Plane and Time class. This class.pdf
Create a Flight class that uses the Plane and Time class. This class.pdf
 
Create a JAVA program that performs file IO and database interaction.pdf
Create a JAVA program that performs file IO and database interaction.pdfCreate a JAVA program that performs file IO and database interaction.pdf
Create a JAVA program that performs file IO and database interaction.pdf
 
Implement a queue using a linkedlist (java)SolutionLinkedQueue.pdf
Implement a queue using a linkedlist (java)SolutionLinkedQueue.pdfImplement a queue using a linkedlist (java)SolutionLinkedQueue.pdf
Implement a queue using a linkedlist (java)SolutionLinkedQueue.pdf
 
2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests2012 JDays Bad Tests Good Tests
2012 JDays Bad Tests Good Tests
 
Executing Sql Commands
Executing Sql CommandsExecuting Sql Commands
Executing Sql Commands
 
Executing Sql Commands
Executing Sql CommandsExecuting Sql Commands
Executing Sql Commands
 
Advance Java Programs skeleton
Advance Java Programs skeletonAdvance Java Programs skeleton
Advance Java Programs skeleton
 
My java file
My java fileMy java file
My java file
 
3 database-jdbc(1)
3 database-jdbc(1)3 database-jdbc(1)
3 database-jdbc(1)
 
2019-10-05 - Untangled - Voxxed days ticino
2019-10-05 - Untangled - Voxxed days ticino2019-10-05 - Untangled - Voxxed days ticino
2019-10-05 - Untangled - Voxxed days ticino
 
help me Java projectI put problem and my own code in the linkmy .pdf
help me Java projectI put problem and my own code in the linkmy .pdfhelp me Java projectI put problem and my own code in the linkmy .pdf
help me Java projectI put problem and my own code in the linkmy .pdf
 
C# labprograms
C# labprogramsC# labprograms
C# labprograms
 
Embedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for JavaEmbedded Typesafe Domain Specific Languages for Java
Embedded Typesafe Domain Specific Languages for Java
 
Data struture lab
Data struture labData struture lab
Data struture lab
 
Using NetBeansImplement a queue named QueueLL using a Linked List .pdf
Using NetBeansImplement a queue named QueueLL using a Linked List .pdfUsing NetBeansImplement a queue named QueueLL using a Linked List .pdf
Using NetBeansImplement a queue named QueueLL using a Linked List .pdf
 

Kürzlich hochgeladen

Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
Kamal Acharya
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Kandungan 087776558899
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
MayuraD1
 

Kürzlich hochgeladen (20)

Moment Distribution Method For Btech Civil
Moment Distribution Method For Btech CivilMoment Distribution Method For Btech Civil
Moment Distribution Method For Btech Civil
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Wadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptxWadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptx
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to Computers
 

Railway reservation system

  • 1. PROJECT REPORT RAILWAY RESERVATION SYSTEM 2015-16 Faculty concern By. Dr. Harikesh Singh Prashant Sharma CSE Dept. 131042 ECE A2
  • 2. TABLE OF CONTENTS S.No Topic Page No. 1. Main Frame 3 2. Check Train Schedule Frame 5 3. Check Seat Availability Frame 8 4. Book Ticket Frame 11 5. Check Ticket Frame 15 6. Cancel Ticket Frame 17 7. How to create a SQL file 19 8. How to use a SQL file 20
  • 3. MAIN FRAME CODE: //code for radio button check train schedule Trainbtwstations a=new Trainbtwstations(); a.setVisible(true); //code for radio button book ticket Book d=new Book(); d.setVisible(true); //code for radio button check availiability Checkavailability e=new Checkavailability(); e.setVisible(true); //code for radio button check your ticket CheckTicket a=new CheckTicket(); a.setVisible(true);
  • 4. //code for radio button cancel your ticket Cancel b=new Cancel(); b.setVisible(true); //code for exit button System.exit(0);
  • 5. CHECK TRAIN SCHEDULE FRAME CODE: IMPORT FILES: import java.sql.*; import java.sql.DriverManager; import java.sql.Statement; import java.sql.ResultSet; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; CODE FOR CHECK TRAIN BUTTON String start=(String)classs1.getSelectedItem(); String fin=(String)classs2.getSelectedItem(); if (start.isEmpty()) {
  • 6. JOptionPane.showMessageDialog(this,"Enter the Starting destination"); } if (fin.isEmpty()) { JOptionPane.showMessageDialog(this,"Enter the final destination"); } else { DefaultTableModel model=(DefaultTableModel) tab1.getModel(); Connection con=null; try { Class.forName("com.mysql.jdbc.Driver"); con=DriverManager.getConnection("jdbc:mysql://localhost:3306/railway","root","root"); if(con!=null){ Statement stmt =con.createStatement(); //String query="SELECT * from trainbtw where (source = '"+start+"' and des = '"+fin+"');"; ResultSet rs=stmt.executeQuery("SELECT * from trainbtw where (source = '"+start+"' and des = '"+fin+"');"); while (rs.next()) { int tn = rs.getInt("tno"); String tname = rs.getString("tname"); String strt = rs.getString("source"); String fnl = rs.getString("des"); model.addRow(new Object[]{tn,tname,strt,fnl}); } } }
  • 7. catch (Exception e) { JOptionPane.showMessageDialog(null, "error in connectivity"); } } } CODE FOR HOME BUTTON OnlineReservation b=new OnlineReservation(); b.setVisible(false); CODE FOR NEXT BUTTON Checkavailability b=new Checkavailability(); b.setVisible(true);
  • 8. CHECK SEAT AVAILABILITY FRAME CODE: IMPORT FILES: import java.sql.*; import java.sql.DriverManager; import java.sql.Statement; import java.sql.ResultSet; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel CODE FOR CHECK AVAILABILITY BUTTON String tno=t1.getText(); DefaultTableModel model=(DefaultTableModel)tab1.getModel(); Connection con=null; try{ Class.forName("com.mysql.jdbc.Driver"); con=DriverManager.getConnection("jdbc:mysql://localhost:3306/railway","root","root"); Statement stmt=con.createStatement(); //String query="select * from avail where TableNo='"+tno+"' ;"; ResultSet rs=stmt.executeQuery("select * from avail where TrainNo='"+tno+"' ;"); while(rs.next()){
  • 9. String tn=rs.getString("TrainNo"); String tname=rs.getString("TrainName"); String fac=rs.getString("FirstAC"); String sac=rs.getString("SecondAC"); String tac=rs.getString("ThirdAC"); String sle=rs.getString("Sleeper"); model.addRow(new Object[]{tn,tname,fac,sac,tac,sle}); } } catch(Exception e){ JOptionPane.showMessageDialog(rootPane, "error"); } CODE FOR GET TICKET BUTTON Book h=new Book(); h.setVisible(true); CODE FOR BACK BUTTON Trainbtwstations b=new Trainbtwstations(); b.setVisible(true); CODE FOR HOME BUTTON OnlineReservation b=new OnlineReservation(); b.setVisible(true);
  • 10. CODE FOR COMBO BOX if(c1.getSelectedIndex()==0) t1.setText("" +3245); else if(c1.getSelectedIndex()==1) t1.setText("" +2345); else if(c1.getSelectedIndex()==2) t1.setText("" +2931); else if(c1.getSelectedIndex()==3) t1.setText("" +8412); else if(c1.getSelectedIndex()==4) t1.setText("" +3429); else if(c1.getSelectedIndex()==5) t1.setText("" +7103);
  • 11. BOOK TICKET FRAME CODE: IMPORT FILES: import java.sql.*; import java.sql.DriverManager; import java.sql.Statement; import javax.swing.JOptionPane; CODE FOR SUBMIT BUTTON String tno=t2.getText(); String tname=(String)c2.getSelectedItem(); String source=(String)classs1.getSelectedItem(); String des=(String)classs2.getSelectedItem(); String name=t5.getText(); String cla=(String)classs.getSelectedItem(); String age=t7.getText(); String contact=t6.getText();
  • 12. String sex=""; if(Male.isSelected()){ sex="Male"; } else if(Female.isSelected()){ sex="Female"; } else if(other.isSelected()){ sex="Other"; } String date=t1.getText(); Connection con=null; try{ Class.forName("com.mysql.jdbc.Driver"); con=DriverManager.getConnection("jdbc:mysql://localhost:3306/railway","root","root"); if(con!=null){ Statement stmt=con.createStatement(); int pnr=100000; ResultSet rs=stmt.executeQuery("select pnr from book order by pnr desc limit 1"); while(rs.next()){ pnr=rs.getInt("pnr"); } pnr++; String query="insert into book values("+pnr+","+tno+",'"+tname+"','"+source+"','"+des+"','"+cla+"','"+name+"',"+contact+", "+age+",'"+sex+"','"+date+"')"; int r=stmt.executeUpdate(query); if(r!=0){
  • 13. ResultSet rs1=stmt.executeQuery("select "+cla+" from avail where TrainNo="+tno); int no_seat=0; while(rs1.next()){ no_seat=rs1.getInt(1); } no_seat--; int r1=stmt.executeUpdate("update avail set "+cla+"="+no_seat+" where TrainNo="+tno); JOptionPane.showMessageDialog(rootPane, "Your pnr : "+pnr); if(r1!=0){ this.dispose(); new OnlineReservation().setVisible(true); } } else{ JOptionPane.showMessageDialog(rootPane, "booking not Possible / worng credentials: "); } } else{ JOptionPane.showMessageDialog(rootPane, "connection error "); } } catch(Exception e) { System.out.println(e); //JOptionPane.showMessageDialog(rootPane, "ERROR"); } } CODE FOR COMBO BOX
  • 14. if(c2.getSelectedIndex()==0) t2.setText("" +0000); else if(c2.getSelectedIndex()==1) t2.setText("" +3245); else if(c2.getSelectedIndex()==2) t2.setText("" +2345); else if(c2.getSelectedIndex()==3) t2.setText("" +2931); else if(c2.getSelectedIndex()==4) t2.setText("" +8412); else if(c2.getSelectedIndex()==5) t2.setText("" +3429); else if(c2.getSelectedIndex()==6) t2.setText("" +7103); CODE FOR BACK BUTTON Checkavailability b=new Checkavailability(); b.setVisible(true); CODE FOR HOME BUTTON OnlineReservation b=new OnlineReservation(); b.setVisible(true);
  • 15. CHECK TICKET FRAME CODE: IMPORT FILES: import java.sql.*; import java.sql.DriverManager; import java.sql.Statement; import java.sql.ResultSet; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; CODE FOR CHECK BUTTON String n=t1.getText(); String a=t2.getText(); DefaultTableModel model=(DefaultTableModel) tab1.getModel(); Connection con=null; try{ Class.forName("com.mysql.jdbc.Driver"); con=DriverManager.getConnection("jdbc:mysql://localhost:3306/railway","root","root"); if(con!=null){
  • 16. Statement stmt=con.createStatement(); ResultSet rs=stmt.executeQuery("SELECT pnr,tno,tname,class,name,age from book where (pnr = "+n+" and name = '"+a+"');"); if(rs.next()) { String po=rs.getString("pnr"); String to=rs.getString("tno"); String tn=rs.getString("tname"); String cl=rs.getString("class"); String na=rs.getString("name"); String ag=rs.getString("age"); model.addRow(new Object[]{to,po,na,ag,tn,cl}); } else { JOptionPane.showMessageDialog(rootPane,"PNR or Name is wrong"); } } } catch(Exception e){ JOptionPane.showMessageDialog(rootPane, "error"); } CODE FOR HOME BUTTON OnlineReservation b=new OnlineReservation(); b.setVisible(true); CODE FOR CONFIRM BUTTON d1.setVisible(true);
  • 17. CANCEL TICKET FRAME CODE: IMPORT FILES: import java.sql.*; import java.sql.DriverManager; import java.sql.Statement; import java.sql.ResultSet; import java.sql.SQLException; import javax.swing.JOptionPane; import javax.swing.table.DefaultTableModel; CODE FOR CANCEL YOUR TICKET BUTTON String a=t1.getText(); String name=t2.getText(); String cla=(String)classs2.getSelectedItem(); String tno=t3.getText(); try{ Class.forName("com.mysql.jdbc.Driver"); Connection con=DriverManager.getConnection ("jdbc:mysql://localhost:3306/railway","root","root"); Statement stmt=con.createStatement();
  • 18. //String query="delete from book where pnr='"+a+"' and name='"+name+"';"; int r=stmt.executeUpdate("delete from book where pnr='"+a+"';"); if(r!=0){ ResultSet rs1=stmt.executeQuery("select "+cla+" from avail where TrainNo="+tno); int no_seat=0; while(rs1.next()){ no_seat=rs1.getInt(1); } no_seat++; int r1=stmt.executeUpdate("update avail set "+cla+"="+no_seat+" where TrainNo="+tno); d3.setVisible(true); } else { d2.setVisible(true); } } catch(ClassNotFoundException e) { JOptionPane.showMessageDialog(rootPane, "ERROR"); } catch (SQLException e) { JOptionPane.showMessageDialog(rootPane, "ERROR"); } CODE FOR HOME BUTTON OnlineReservation b=new OnlineReservation(); b.setVisible(true);
  • 19. HOW TO CREATA A SQL FILE OF A DATABASE FROM COMMAND PROMPT This is the procedure to create a sql file from a database in mysql: 1. Open command prompt in admin mode. 2.Now change directory to the bin directory of the mysql. 3.Now type the below command in the command prompt and then enter the password of your mysql. 4.Press enter and now you can find your database sql file in the bin folder of mysql.
  • 20. HOW TO USE A SQL FILE FROM COMMAND PROMPT IN ANOTHER PC Procedure: 1.Open mysql and create database (give any name); 2.Now type command use “databasename”; 3.Now paste the .sql file in your bin folder of mysql. 4.Now open command prompt and change the directory to the bin directory of mysql. 5. now type the command as shown below