You are on page 1of 31

INFORMATICS

PRACTICES
PROJECT
ON

PIZZA POINT

SERIAL PARTICULARS PAGE


NO. NO.
1. ACKNOWLEDGMENT 3
2. CERTIFICATE 4
3. DATABASE DESIGN 5
4. NETBEANS DESIGN 6-29
a.)Selection
b.)Add record
c.)Login
d.)Main Menu
e.)Search
f.)Update
g.)Delete
h.)TABLE MODEL

5. BIBLIOGRAPHY 30

ACKNOWLEDGEMEN
T
I would like to express my sincere gratitude to Sir Naveen
Gupta, our IP teacher for his vital support, guidance and
encouragement, without whom these project have not come
forth. I would also like to express my gratitude to my parents,
my sister and friends for their support during the making of this
project. Last but not the least, would like take this opportunity to
thank our principal for her invaluable support &for all facilities
made available to us at the school.

Sincerely,

KARAN
XII-D
Enrollment No. :

CERTIFICATE
This is to certify that KARAN SINGH OBEROI of class
XII-D, Enrolment No………………has done this project
under my supervision and completed it to my satisfaction.
Naveen Gupta
(PGT-Informatics Practices)

DATABASE
DESIGN
NET
BEANS
FRAMES
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

new Customer_Id().setVisible(true); this.setVisible(false);

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

new Password().setVisible(true); this.setVisible(false);

}
import com.mysql.jdbc.Connection;

import com.mysql.jdbc.Statement;

import java.sql.DriverManager;

import javax.swing.JOptionPane;

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

int cno=Integer.parseInt(jTextField1.getText());
String cn=jTextField2.getText();

String add=jTextField3.getText();

int ph=Integer.parseInt(jTextField4.getText());

String em=jTextField5.getText();

int a=jComboBox1.getSelectedIndex();

String name="";

int p = 0;

if(a==0)

name="Farmhouse Pizza";

p=300;

else if(a==1)

name="Cheese Burst Pizza";

p=350;

else if(a==2)

name="Chicken Tikka Pizza";

p=400;

else if(a==3)

name="Chicken Seekh Pizza";


p=450;

jTextField6.setText(""+p);

try

Class.forName("java.sql.DriverManager");

Connection
con=(Connection)DriverManager.getConnection("jdbc:mysql://localhost:3306/pizza","root","sms");

Statement stmt=(Statement)con.createStatement();

String query="insert into CustomerDetails


values("+cno+",'"+cn+"','"+add+"',"+ph+",'"+em+"','"+name+"','"+p+"');";

stmt.executeUpdate(query);

JOptionPane.showMessageDialog(null,"Record Added Successfully");

jTextField1.setText("");

jTextField2.setText("");

jTextField3.setText("");

jTextField4.setText("");

jTextField5.setText("");

jTextField6.setText("");

catch(Exception e)

JOptionPane.showMessageDialog(null,e.getMessage());

}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

jTextField1.setText("");

jTextField2.setText("");

jTextField3.setText("");

jTextField4.setText("");

jTextField5.setText("");

jTextField6.setText("");

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {

System.exit(0);

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {

new selection().setVisible(true); this.setVisible(false}


import javax.swing.JOptionPane;

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

String user=jTextField1.getText();

String pass=new String(jPasswordField1.getPassword());

if((user.compareTo("admin")==0)&&(pass.compareTo("sms")==0))

JOptionPane.showMessageDialog(null,"Welcome Admin" +

"");

new mainmenu().setVisible(true); this.setVisible(false);

}
}

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

new mainmenu().setVisible(true); this.setVisible(false);

private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {

new update().setVisible(true); this.setVisible(false); }

private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {

new Delete().setVisible(true); this.setVisible(false); }

private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {

new search().setVisible(true); this.setVisible(false)

private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {

new tablemodel().setVisible(true); this.setVisible(false }


private void jMenu4ActionPerformed(java.awt.event.ActionEvent evt) {

System.exit(0); }
import com.mysql.jdbc.Connection;

import com.mysql.jdbc.Statement;

import java.sql.DriverManager;

import java.sql.ResultSet;

import javax.swing.JOptionPane;

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

int cno=Integer.parseInt(jTextField1.getText());

if(cno==0) {

JOptionPane.showMessageDialog(this,"ENTER CustomerNumber TO SEARCH");

} else {

try {

Class.forName("java.sql.DriverManager");

Connection con=
(Connection)DriverManager.getConnection("jdbc:mysql://localhost:3306/pizza","root","sms");

Statement stmt=(Statement)con.createStatement();

String query="SELECT * FROM CustomerDetails where Customer_Number='"+ cno+"';";

ResultSet rs=stmt.executeQuery(query);

if(rs.next()) {

String Name=rs.getString("Name");

String address=rs.getString("Address");

int ph=rs.getInt("Phone_no");

String eid=rs.getString("emailId");

String m=rs.getString("pizzaname");
int p=rs.getInt("price");

jTextField2.setText(Name);

jTextField3.setText(address);

jTextField4.setText(""+ph);

jTextField5.setText(eid);

jTextField6.setText(m);

jTextField7.setText(""+p);

JOptionPane.showMessageDialog(this,"Search Found");

} else

JOptionPane.showMessageDialog(this,"Sorry!Search not Found");

catch(Exception e) {

JOptionPane.showConfirmDialog(this,e.getMessage());

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

jTextField1.setText("");

jTextField2.setText("");

jTextField3.setText("");

jTextField4.setText("");
jTextField5.setText("");

jTextField6.setText("");

jTextField7.setText("");

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {

new mainmenu().setVisible(true); this.setVisible(false);

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {

System.exit(0); }
import com.mysql.jdbc.Connection;

import com.mysql.jdbc.Statement;

import java.sql.DriverManager;

import java.sql.ResultSet;

import javax.swing.JOptionPane;

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

int cno=Integer.parseInt(jTextField1.getText());

String cn=jTextField2.getText();

String add=jTextField3.getText();

int ph=Integer.parseInt(jTextField4.getText());

String em=jTextField5.getText();

int a=jComboBox1.getSelectedIndex();

String name="";

int p = 0;

if(a==0)

name="Farmhouse Pizza";

p=300;
}

else if(a==1)

name="Cheese Burst Pizza";

p=350;

else if(a==2)

name="Chicken Tikka Pizza";

p=400;

else if(a==3)

name="Chicken Seekh Pizza";

p=450;

jTextField7.setText(""+p);

try {

Class.forName("java.sql.DriverManager");

Connection con=

(Connection)DriverManager.getConnection("jdbc:mysql://localhost:3306/pizza","root","sms");

Statement stmt=(Statement)con.createStatement();

String query="update CustomerDetails set


Name='"+cn+"',Address='"+add+"',Phone_no='"+ph+"',emailId='"+em+"',pizzaname='"+name+"',price='"
+p+"' where Customer_Number='"+cno+"';";
stmt.executeUpdate(query);

JOptionPane.showMessageDialog(null,"RECORD UPDATED SUCESSFULLY");

jTextField1.setText("");

jTextField2.setText("");

jTextField3.setText("");

jTextField4.setText("");

jTextField5.setText("");

jTextField6.setText("");

} catch(Exception e) {

JOptionPane.showMessageDialog(this,e.getMessage());

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

int cno=Integer.parseInt(jTextField1.getText());

if(cno==0) {

JOptionPane.showMessageDialog(this,"ENTER Customer_Number TO SEARCH");

} else {

try {

Class.forName("java.sql.DriverManager");

Connection con=
(Connection)DriverManager.getConnection("jdbc:mysql://localhost:3306/pizza","root","sms");

Statement stmt=(Statement)con.createStatement();

String query="SELECT * FROM CustomerDetails where Customer_Number='"+ cno+"';";


ResultSet rs=stmt.executeQuery(query);

if(rs.next()) {

String Name=rs.getString("Name");

String address=rs.getString("Address");

int ph=rs.getInt("Phone_no");

String eid=rs.getString("emailId");

String m=rs.getString("pizzaname");

int p=rs.getInt("price");

jTextField2.setText(Name);

jTextField3.setText(address);

jTextField4.setText(""+ph);

jTextField5.setText(eid);

jComboBox1.setSelectedItem(m);

jTextField7.setText(""+p);

JOptionPane.showMessageDialog(this,"Search Found");

} else

JOptionPane.showMessageDialog(this,"Sorry!Search not Found");

catch(Exception e) {

JOptionPane.showConfirmDialog(this,e.getMessage());

}
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {

new mainmenu().setVisible(true); this.setVisible(false);

private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {

jTextField1.setText("");

jTextField2.setText("");

jTextField3.setText("");

jTextField4.setText("");

jTextField5.setText("");

jTextField6.setText("");

jTextField7.setText("");

}
import com.mysql.jdbc.Connection;

import com.mysql.jdbc.Statement;

import java.sql.DriverManager;

import java.sql.ResultSet;

import javax.swing.JOptionPane;
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

Connection con;

Statement st;

ResultSet rs;

try

Class.forName("java.sql.Driver");

con=(Connection) DriverManager.getConnection("jdbc:mysql://localhost/pizza","root","sms");

st= (Statement) con.createStatement();

//int cno=Integer.parseInt(jTextField1.getText());

int opt=JOptionPane.showConfirmDialog(null,"Are You Sure You Want To Delete This Record");

if(opt==JOptionPane.YES_OPTION){

String query="delete from CustomerDetails where Customer_Number='"+jTextField1.getText()+"'";

JOptionPane.showMessageDialog(null,"Record Deleted Successfully");

st.executeUpdate(query);

jTextField1.setText("");

jTextField2.setText("");

jTextField3.setText("");

jTextField4.setText("");

jTextField5.setText("");

jTextField6.setText("");

jTextField7.setText("");
}

catch(Exception ee)

JOptionPane.showMessageDialog(null, ee);

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

int cno=Integer.parseInt(jTextField1.getText());

if(cno==0)

JOptionPane.showMessageDialog(this,"ENTER Customer_Number TO SEARCH");

else

try

Class.forName("java.sql.DriverManager");

Connection con=
(Connection)DriverManager.getConnection("jdbc:mysql://localhost:3306/pizza","root","sms");

Statement stmt=(Statement)con.createStatement();

String query="SELECT * FROM CustomerDetails where Customer_Number='"+ cno+"';";


ResultSet rs=stmt.executeQuery(query);

if(rs.next())

String Name=rs.getString("Name");

String address=rs.getString("Address");

int ph=rs.getInt("Phone_no");

String eid=rs.getString("emailId");

String m=rs.getString("pizzaname");

int p=rs.getInt("price");

jTextField2.setText(Name);

jTextField3.setText(address);

jTextField4.setText(""+ph);

jTextField5.setText(eid);

jTextField6.setText(m);

jTextField7.setText(""+p);

JOptionPane.showMessageDialog(this,"Search Found");

else

JOptionPane.showMessageDialog(this,"Sorry!Search not Found");

catch(Exception e)

{
JOptionPane.showConfirmDialog(this,e.getMessage());

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {

new mainmenu().setVisible(true); this.setVisible(false); // TODO add your handling code here:

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {

System.exit(0);

private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {

jTextField1.setText("");

jTextField2.setText("");

jTextField3.setText("");

jTextField4.setText("");

jTextField5.setText("");

jTextField6.setText("");

jTextField7.setText(""); // TODO add your handling code here:

}
import com.mysql.jdbc.Connection;

import com.mysql.jdbc.Statement;

import java.sql.DriverManager;

import java.sql.ResultSet;

import javax.swing.JOptionPane;

import javax.swing.table.DefaultTableModel;

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

DefaultTableModel model=(DefaultTableModel)

jTable1.getModel();

int rows=model.getRowCount();

if(rows>0)

for(int i=0;i<rows;i++)

model.removeRow(0);

try
{

Class.forName("java.sql.DriverManager");

Connection con=

(Connection)DriverManager.getConnection("jdbc:mysql://localhost:3306/pizza","root","sms");

Statement stmt=(Statement)con.createStatement();

String q="select * from Customerdetails";

ResultSet rs=stmt.executeQuery(q);

while(rs.next())

int name=rs.getInt("customer_number");

String nt=rs.getString("Name");

String add=rs.getString("Address");

int pno=rs.getInt("Phone_no");

String eid=rs.getString("emailId");

String mob=rs.getString("pizzaname");

int p=rs.getInt("Price");

model.addRow(new Object[]{name,nt,add,pno,eid,mob,p});

catch(Exception e1)

JOptionPane.showMessageDialog(this,e1.getMessage());

}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

new mainmenu().setVisible(true); this.setVisible(false); }

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {

System.exit(0); }
BIBLIOGRAPHY

THE INFORMATION OF THIS PROJECT HAS BEEN


COLLECTED FROM THE FOLLOWING SOURCES:

• CBSE book for informatics practices.

• Saraswati informatics practices book

• SumitaArora informatics practices book

You might also like