Professional Documents
Culture Documents
Welcome Page: //coding For "NEXT" Button
Welcome Page: //coding For "NEXT" Button
Welcome Page: //coding For "NEXT" Button
Page 1 of 51
Home Page for Cab Booking System
Page 2 of 51
Log In Window
// Import package
import java.sql.*;
import javax.swing.JOptionPane;
Page 4 of 51
{
JOptionPane.showMessageDialog(this, e.getMessage());
}
Page 5 of 51
Input Window for Sign up
// Import package
import java.sql.*;
import javax.swing.JOptionPane;
Page 6 of 51
// Coding for “SAVE” button
Page 7 of 51
Output Window for Sign up
Page 8 of 51
Homepage For Main Menu
Page 10 of 51
Cab Booking Window
Page 11 of 51
Enter Cab Details
Import package//
import java.sql.*;
import javax.swing.JOptionPane;
Page 12 of 51
String price
= t5.getText();
try
{
Class.forName("java.sql.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost/x11","root","123");
Statement stmt = con.createStatement();
String query="insert into cab
values('"+taxi_no+"','"+model_type+"','"+driver+"','"+capacity+"','"+price+"');";
int executeUpdate = stmt.executeUpdate(query);
JOptionPane.showMessageDialog(this, "record add successfully");
t1.setText(" ");
t2.setText(" ");
t3.setText(" ");
t4.setText(" ");
t5.setText(" ");
}
catch (Exception e)
{
JOptionPane.showMessageDialog(this, e.getMessage());
}
Page 13 of 51
t4.setText(" ");
t5.setText(" ");
Page 14 of 51
Coding for “EXIT” button
Page 15 of 51
Output Window for Cab Detail
Page 16 of 51
Enter Customer Details
// Import package
import java.sql.*;
import javax.swing.JOptionPane;
Page 17 of 51
try
{
Class.forName("java.sql.DriverManager");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost/x11","root","123");
Statement stmt = con.createStatement();
String query="insert into cust
values('"+id+"','"+name+"','"+address+"','"+mobile_no+"')";
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(this, "record add successfully");
// t6.setText(" ");
// t7.setText(" ");
//t8.setText(" ");
// t9.setText(" ");
}
catch (Exception e)
{
JOptionPane.showMessageDialog(this,"record could not be added");
}
Page 18 of 51
Coding for “ BACK TO MAIN MENU”Button
Page 19 of 51
Coding for “QUIT” button
Page 20 of 51
Output Window for Customer Details
Page 21 of 51
BOOK TAXI
// Import package
import java.sql.*;
import javax.swing.JOptionPane;
Page 22 of 51
int amount= 0;
int discount= Integer.parseInt(t14.getText());
String date= t15.getText();
String drop= t16.getText();
String taxi_id= t17.getText();
int price= Integer.parseInt(t18.getText());
try
{
Class.forName("java.sql.DriverManager");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost/x11","root","123");
Statement stmt = con.createStatement();
String query="insert into book
values('"+Book_id+"','"+date+"','"+cust_id+"','"+taxi_id+"','"+person+"','"+price+"','"+
discount+"','"+amount+"');";
stmt.executeUpdate(query);
if (r1.isSelected())
amount=(price*person-(price*discount/100));
else
amount=(price*person);
t19.setText(""+amount);
Page 23 of 51
Coding for “ BACK TO MAIN MENU”Button
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
new p5().setVisible(true);
Page 24 of 51
Coding for “QUIT” button
int choice = JOptionPane.showOptionDialog(null,
"Do you really want to exit??",
"Quit?",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null, null, null);
if (choice == JOptionPane.YES_OPTION)
{
JOptionPane.showMessageDialog(this, "THANKS FOR VISITING");
System.exit(0)
Page 25 of 51
Output Window for BOOKING TAXI
Page 26 of 51
Coding for “QUIT” button
int choice = JOptionPane.showOptionDialog(null,
"Do you really want to exit??",
"Quit?",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null, null, null);
if (choice == JOptionPane.YES_OPTION)
{
JOptionPane.showMessageDialog(this, "THANKS FOR VISITING");
System.exit(0);
//Click on “VIEW/SHOW”BUTTON
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
new p12().setVisible(true);
Page 27 of 51
VIEW /SHOW WINDOW
Page 28 of 51
Coding for “ CAB DETAIL” Button
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
new p9().setVisible(true);
Page 29 of 51
VIEW ENTER CAB DETAIL
// Import package
import java.sql.*;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
Class.forName("java.sql.DriverManager");
Page 30 of 51
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost:3306/x11",
"root", "123");
Statement st =(Statement)con.createStatement();
String query="select* from cab;";
ResultSet rs=st.executeQuery(query);
while (rs.next())
{
String d1=rs.getString("Taxi_no");
String d2=rs.getString("model_type");
String d3=rs.getString("Driver");
String d4=rs.getString("Capacity");
String d5=rs.getString("Price");
model.addRow(new Object[]{d1,d2,d3,d4,d5});
}
rs.close();
con.close();
st.close();
}
catch (Exception e)
{
JOptionPane.showMessageDialog(this, e.getMessage());
}
Page 31 of 51
Output VIEW ENTER CAB DETAIL
Page 32 of 51
Coding for “QUIT” button
int choice = JOptionPane.showOptionDialog(null,
"Do you really want to exit??",
"Quit?",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null, null, null);
if (choice == JOptionPane.YES_OPTION)
{
JOptionPane.showMessageDialog(this, "THANKS FOR VISITING");
System.exit(0);
}
Page 33 of 51
VIEW ENTER CUSTOMER DETAIL
// Import package
import java.sql.*;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
Page 34 of 51
// TODO add your handling code here:
DefaultTableModel model=(DefaultTableModel)tab2.getModel();
try
{
Class.forName("java.sql.DriverManager");
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost:3306/x11",
"root", "123");
Statement st =(Statement)con.createStatement();
String query="select* from cust;";
ResultSet rs=st.executeQuery(query);
while (rs.next())
{
String d1=rs.getString("id");
String d2=rs.getString("Name");
String d3=rs.getString("Address");
String d4=rs.getString("Mobile_no");
model.addRow(new Object[]{d1,d2,d3,d4,});
}
rs.close();
con.close();
st.close();
}
catch (Exception e)
{
JOptionPane.showMessageDialog(this, e.getMessage());
}
Page 35 of 51
Output VIEW ENTER CUSTOMER
DETAIL
Page 36 of 51
Coding for “QUIT” button
int choice = JOptionPane.showOptionDialog(null,
"Do you really want to exit??",
"Quit?",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null, null, null);
if (choice == JOptionPane.YES_OPTION)
{
JOptionPane.showMessageDialog(this, "THANKS FOR VISITING");
System.exit(0);
}
Page 37 of 51
VIEW ENTER BOOKING DETAIL
// Import package
import java.sql.*;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
Page 38 of 51
Coding for “ DISPLAY” Button
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
DefaultTableModel model=(DefaultTableModel)tab3.getModel();
try
{
Class.forName("java.sql.DriverManager");
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost:3306/x11",
"root", "123");
Statement st =(Statement)con.createStatement();
String query="select* from book;";
ResultSet rs=st.executeQuery(query);
while (rs.next())
{
String d1=rs.getString("Book_id");
String d2=rs.getString("Date");
String d3=rs.getString("Customer_id");
String d4=rs.getString("Cab_id");
String d5=rs.getString("Person");
String d6=rs.getString("Price");
String d7=rs.getString("Discount");
String d8=rs.getString("Amount");
model.addRow(new Object[]{d1,d2,d3,d4,d5,d6,d7,d8});
}
rs.close();
Page 39 of 51
con.close();
st.close();
}
catch (Exception e)
{
JOptionPane.showMessageDialog(this, e.getMessage());
}
Page 40 of 51
Output VIEW ENTER BOOK TAXI
DETAIL
Page 41 of 51
Coding for “QUIT” button
int choice = JOptionPane.showOptionDialog(null,
"Do you really want to exit??",
"Quit?",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null, null, null);
if (choice == JOptionPane.YES_OPTION)
{
JOptionPane.showMessageDialog(this, "THANKS FOR VISITING");
System.exit(0);
}
Page 42 of 51
VIEW ENTER SIGNUP DETAIL
// Import package
import java.sql.*;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
Page 43 of 51
try
{
Class.forName("java.sql.DriverManager");
Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost:3306/x11",
"root", "123");
Statement st =(Statement)con.createStatement();
String query="select* from Signup;";
ResultSet rs=st.executeQuery(query);
while (rs.next())
{
String d1=rs.getString("Customer_id");
String d2=rs.getString("First_name");
String d3=rs.getString("Last_name");
String d4=rs.getString("Phone_no");
String d5=rs.getString("Email_id");
String d6=rs.getString("City");
String d7=rs.getString("State");
String d8=rs.getString("Address");
model.addRow(new Object[]{d1,d2,d3,d4,d5,d6,d7,d8});
}
rs.close();
con.close();
st.close();
}
catch (Exception e)
{
JOptionPane.showMessageDialog(this, e.getMessage());
}
Page 44 of 51
Output VIEW ENTER SIGNUP
DETAIL
Page 45 of 51
Coding for “QUIT” button
int choice = JOptionPane.showOptionDialog(null,
"Do you really want to exit??",
"Quit?",
JOptionPane.YES_NO_OPTION,
JOptionPane.QUESTION_MESSAGE,
null, null, null);
if (choice == JOptionPane.YES_OPTION)
{
JOptionPane.showMessageDialog(this, "THANKS FOR VISITING");
System.exit(0);
}
Page 46 of 51
MySQL
Tables
Page 47 of 51
Database Name : “XII”
Page 48 of 51
Records in table ‘BOOK’ :
Page 49 of 51
Structure of table ‘CUST’ :
Page 50 of 51
Records in table ‘LOGIN’ :
Page 51 of 51