National Academy
Class Xll
Informative Practices Project on School Book Shop
Submitted to:
Mrs. Rekha arora
Submitted By: Lavish Yadav [Link].1613725
Acknowledgement
From the depth of my heart I express my deep sincere gratitude to the Almighty for the Blessings that had bestowed upon me to do this work. Having a successful project is really a great pleasure to us. Yet all these will not have been possible if not for hard work, persistence and cooperation among the researchers. I would like to extend my sincerest appreciation to the following people who helped accomplish the project. They are the people who contributed much for the success of this endeavor. First of all, I would like to thank my parents and benefactors who have shown their unending support and provided us with necessary materials I needed. Second, I would like to thank my I.P. teacher, Mrs. Rekha Arora for teaching us the fundamental research and investigatory writing and for showing a great deal of patience through the time. Above all, I would like to thank God for giving us the gift of wisdom and understanding and for answering my prayers.
TEACHERS REMARK:-
CERTIFICATE:This is hereby to certify that the original and genuine project work has been carried out to investigate about the subject matter and the related data collection and work done has been completely solely, sincerely and satisfactorily by LAVISH YADAV of class-XII(A), NATIONAL ACADEMY, regarding his project titled Book
Shop.
Teachers Signature:-
Coding behind [Link]
import [Link].*; import [Link]; import [Link];/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* * [Link] * * Created on Nov 29, 2011, [Link] AM */ /** * * @author student58 */ public class AllItem extends [Link] { Connection con = null; Statement stmt = null; ResultSet rs = null; /** Creates new form AllItem */ public AllItem() { initComponents(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") Generated Code private void abtnActionPerformed([Link] evt) { DefaultTableModel model = (DefaultTableModel)[Link](); try{ [Link]("[Link]"); con = [Link]("jdbc:mysql://localhost:3306/Lavish","root","root"); stmt = [Link](); String query = "Select * from book;"; rs = [Link](query); while([Link]()){ String bcode = [Link]("bcode"); String bname = [Link]("bname"); String amt = [Link]("amt"); String QtyA = [Link]("QtyA");
[Link](new Object[]{bcode,bname,amt,QtyA});} }catch(Exception e){ [Link](null,[Link]()); } // TODO add your handling code here: } private void lbtnActionPerformed([Link] evt) { [Link](false); new Main().setVisible(true);// TODO add your handling code here: } private void bbtnActionPerformed([Link] evt) { [Link](false); new SaleBook().setVisible(true); // TODO add your handling code here: } /** * @param args the command line arguments */ public static void main(String args[]) { [Link](new Runnable() { public void run() { new AllItem().setVisible(true); } }); } // Variables declaration - do not modify private [Link] abtn; private [Link] bbtn; private [Link] bookTbl; private [Link] jScrollPane1; private [Link] lbtn; // End of variables declaration }
Coding behind [Link]
/* * [Link] /** * * @author student */ public class ENDING extends [Link] { /** Creates new form ENDING */ public ENDING() { initComponents(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") Generated Code private void ebtnActionPerformed([Link] evt) { // TODO add your handling code here: [Link](0); } /** * @param args the command line arguments */ public static void main(String args[]) { [Link](new Runnable() { public void run() { new ENDING().setVisible(true); } }); } // Variables declaration - do not modify private [Link] ebtn; private [Link] jLabel1; // End of variables declaration }
Coding behind [Link]
/* * [Link] /** * * @author Lavish */ public class Front extends [Link] { /** Creates new form Front */ public Front() { initComponents(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") Generated Code private void jButton1ActionPerformed([Link] evt) { // TODO add your handling code here: [Link](false); new Main().setVisible(true); } /** * @param args the command line arguments */ public static void main(String args[]) { [Link](new Runnable() { public void run() { new Front().setVisible(true); } }); } // Variables declaration - do not modify private [Link] jButton1; private [Link] jLabel1; private [Link] jLabel2; // End of variables declaration }
Coding behind [Link]
import [Link];/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* * [Link] * * Created on Nov 22, 2011, [Link] AM */ /** * * @author Lavish */ public class Main extends [Link] { /** Creates new form Main */ public Main() { initComponents(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") Generated Code private void backbtnActionPerformed([Link] evt) { // TODO add your handling code here: [Link](false); new Front().setVisible(true); } private void libtnActionPerformed([Link] evt) { String pwd = new String([Link]()); if ([Link]("ip")){ [Link](false); new Menu().setVisible(true); }else { [Link](null,"Access [Link] enter correct password"); } }
private void ebtnActionPerformed([Link] evt) { // TODO add your handling code here: [Link](false); new ENDING().setVisible(true); } /** * @param args the command line arguments */ public static void main(String args[]) { [Link](new Runnable() { public void run() { new Main().setVisible(true); } }); } // Variables declaration - do not modify private [Link] backbtn; private [Link] ebtn; private [Link] jLabel1; private [Link] libtn; private [Link] pwdFld; // End of variables declaration }
Coding behind [Link]
import [Link].*; import [Link]; import [Link]; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* * [Link] * * Created on Nov 21, 2011, [Link] AM */ /** * * @author Lavish */ public class Menu extends [Link] { /** Creates new form Menu */ public Menu() { initComponents(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") Generated Code private void lobtnActionPerformed([Link] evt) { [Link](false); new Main().setVisible(true);// TODO add your handling code here: } private void allitmbtnActionPerformed([Link] evt) { [Link](false); new AllItem().setVisible(true); // TODO add your handling code here: } private void salebtnActionPerformed([Link] evt) { [Link](false);
new SaleBook().setVisible(true); }
// TODO add your handling code here:
private void adminbtnActionPerformed([Link] evt) { [Link](false); new adminpswd().setVisible(true); // TODO add your handling code here: } /** * @param args the command line arguments */ public static void main(String args[]) { [Link](new Runnable() { public void run() { new Menu().setVisible(true); } }); } // Variables declaration - do not modify private [Link] adminbtn; private [Link] allitmbtn; private [Link] lobtn; private [Link] salebtn; // End of variables declaration }
Coding behind [Link]
import [Link].*; import [Link]; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* * [Link] * * Created on Nov 29, 2011, [Link] AM */ /** * * @author student58 */ public class SaleBook extends [Link] { Connection con = null; Statement stmt = null; ResultSet rs = null; /** Creates new form SaleBook */ public SaleBook() { initComponents(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") Generated Code private void salebtnActionPerformed([Link] evt) { [Link](); int b=[Link]([Link]()); if([Link]().isEmpty()){[Link](null,"Please enter quantity ");} int qtya = [Link]([Link]()); int qtyo = [Link]([Link]()); if (qtyo>qtya) [Link](rootPane,"Only "+qtya+" items of "+[Link]()+" are in stock! \n Sorry, Cannot take your order."); else {
float amt1= [Link]([Link]()); float amt = qtyo*amt1; int ans1=[Link](rootPane,"surely wanna purchase?"); [Link](""+amt); int qty = qtya-qtyo;{ if(ans1 == JOptionPane.YES_OPTION) [Link](rootPane,"Book [Link] for purchasing"); } try { [Link]("[Link]"); con=[Link]("jdbc:mysql://localhost/Lavish","root","root"); Statement qry = [Link](); String query = "UPDATE book SET QtyA =QtyA-"+qtyo+" where bcode="+b; [Link](query); } catch(Exception e) { [Link](null,[Link]()); } } // TODO add your handling code here: } private void loadBtnActionPerformed([Link] evt) { try { [Link]("[Link]"); con=[Link]("jdbc:mysql://localhost/Lavish","root","root"); //[Link](this, "ok"); stmt = [Link](); String query = "Select * from book where bcode ="+[Link]()+";"; rs = [Link](query); if ([Link]()) { String bcode = [Link]("bcode"); String bname = [Link]("bname"); String amt = [Link]("amt"); String QtyA = [Link]("QtyA"); [Link](bcode); [Link](bname); [Link](amt); [Link](QtyA); } else { [Link](null,"No such record found"); [Link](""); [Link]("");
[Link](""); } } catch(Exception e) { [Link](null,[Link]()); }
// TODO add your handling code here: } private void lobtnActionPerformed([Link] evt) { [Link](false); new Main().setVisible(true);// TODO add your handling code here: } private void clearbtnActionPerformed([Link] evt) { [Link](""); [Link](""); [Link](""); [Link](""); [Link](""); [Link](""); // TODO add your handling code here: } private void backbtnActionPerformed([Link] evt) { [Link](false); new Menu().setVisible(true);// TODO add your handling code here: } private void QtyATFActionPerformed([Link] evt) { // TODO add your handling code here: } private void QtyOTFCaretUpdate([Link] evt) { //[Link]();
// TODO add your handling code here: } private void TotAmtTFActionPerformed([Link] evt) { // TODO add your handling code here: } /** * @param args the command line arguments
*/ public static void main(String args[]) { [Link](new Runnable() { public void run() { new SaleBook().setVisible(true); } }); } // Variables declaration - do not modify private [Link] QtyATF; private [Link] QtyOTF; private [Link] TotAmtTF; private [Link] amtTF; private [Link] backbtn; private [Link] bcodeTF; private [Link] bnameTF; private [Link] clearbtn; private [Link] jLabel1; private [Link] jLabel2; private [Link] jLabel3; private [Link] jLabel4; private [Link] jLabel5; private [Link] jLabel6; private [Link] loadBtn; private [Link] lobtn; private [Link] salebtn; // End of variables declaration }
Coding behind [Link]
import [Link].*; import [Link]; import [Link];/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* * [Link] * * Created on Jul 30, 2007, [Link] AM */ /** * * @author student */ public class admin extends [Link] { Connection con = null; Statement stmt = null; ResultSet rs = null; /** Creates new form admin */ public admin() { initComponents(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") Generated Code private void lobtnActionPerformed([Link] evt) { [Link](false); new Main().setVisible(true);// TODO add your handling code here: } private void clearbtnActionPerformed([Link] evt) { [Link](""); [Link](""); [Link](""); [Link]("");
// TODO add your handling code here: } private void updatebtnActionPerformed([Link] evt) { int ans = [Link](null,"Surely wanna update the record?"); if(ans == JOptionPane.YES_OPTION){ try{ stmt = [Link](); String query ="Update book set bname ='"+ [Link]() +"',amt ='"+[Link]()+"',QtyA ='"+[Link]()+"'WHERE bcode = "+[Link]()+";"; [Link](query); [Link](null,"Record successfully updated."); } catch(Exception e) { [Link](null,"Error in table updation!"); } }// TODO add your handling code here: } private void addbtnActionPerformed([Link] evt) { int ans = [Link](null,"Surely want to add record"); if (ans == JOptionPane.YES_OPTION) { try { [Link]("[Link]"); con=[Link]("jdbc:mysql://localhost/Lavish","root","root"); stmt = [Link](); String bcode = [Link](); String bname = [Link](); String amt = [Link](); String QtyA = [Link](); String strSQL = "Insert into book(bcode,bname,amt,QtyA) values('"+(bcode)+"','"+(bname)+"','"+(amt)+"','"+(QtyA)+"');"; [Link](strSQL); [Link](null,"Record Added!"); [Link](""); [Link](""); [Link](""); [Link](""); } catch(Exception e) { [Link](null,[Link]()); } } // TODO add your handling code here: } private void delbtnActionPerformed([Link] evt) { int res = [Link](null,"wanna delete the record for sure?");
if (res == JOptionPane.YES_OPTION) { try { stmt = [Link](); String query = "Delete from book where bcode ='"+[Link]()+"';"; [Link](query); [Link](null,"Record Deleted!"); } catch(Exception e) { [Link](null,"Error in deletion!"); } }// end of if [Link](""); [Link](""); [Link](""); [Link]("");
// TODO add your handling code here: } private void loadBtnActionPerformed([Link] evt) { try { [Link]("[Link]"); con=[Link]("jdbc:mysql://localhost/Lavish","root","root"); //[Link](this, "ok"); stmt = [Link](); String query = "Select * from book where bcode ="+[Link]()+";"; rs = [Link](query); if ([Link]()) { String bcode = [Link]("bcode"); String bname = [Link]("bname"); String amt = [Link]("amt"); String QtyA = [Link]("QtyA"); [Link](bcode); [Link](bname); [Link](amt); [Link](QtyA); } else { [Link](null,"No such record found"); [Link](""); [Link](""); [Link](""); } } catch(Exception e) { [Link](null,[Link]()); }
// TODO add your handling code here: }
/** * @param args the command line arguments */ public static void main(String args[]) { [Link](new Runnable() { public void run() { new admin().setVisible(true); } }); } // Variables declaration - do not modify private [Link] QtyATF; private [Link] addbtn; private [Link] amtTF; private [Link] bcodeTF; private [Link] bnameTF; private [Link] clearbtn; private [Link] delbtn; private [Link] jLabel1; private [Link] jLabel2; private [Link] jLabel3; private [Link] jLabel4; private [Link] loadBtn; private [Link] lobtn; private [Link] updatebtn; // End of variables declaration }
Coding behind [Link]
import [Link];/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /* * [Link] * * Created on Jul 30, 2007, [Link] AM */ /** * * @author student */ public class adminpswd extends [Link] { /** Creates new form adminpswd */ public adminpswd() { initComponents(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") Generated Code private void libtnActionPerformed([Link] evt) { String pwd = new String([Link]()); if ([Link]("ip")){ [Link](false); new Menu().setVisible(true); } else { [Link](null,"Access [Link] enter correct password"); }{ [Link](false); new adminpswd().setVisible(true);} [Link](false); new admin().setVisible(true); // TODO add your handling code here: } private void backbtnActionPerformed([Link] evt) { [Link](false);
new Menu().setVisible(true); }
// TODO add your handling code here:
/** * @param args the command line arguments */ public static void main(String args[]) { [Link](new Runnable() { public void run() { new adminpswd().setVisible(true); } }); } // Variables declaration - do not modify private [Link] backbtn; private [Link] jLabel1; private [Link] libtn; private [Link] pwdFld; // End of variables declaration }
Coding behind [Link]
* [Link] * * Created on Jan 10, 2012, [Link] PM */ /** * * @author BASE COMPUTERS */ public class coverpage extends [Link] { /** Creates new form coverpage */ public coverpage() { initComponents(); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") Generated Code private void jButton1ActionPerformed([Link] evt) { [Link](false); new Front().setVisible(true);// TODO add your handling code here: } /** * @param args the command line arguments */ public static void main(String args[]) { [Link](new Runnable() { public void run() { new coverpage().setVisible(true); } }); } // Variables declaration - do not modify private [Link] jButton1; private [Link] jLabel1; private [Link] jLabel2; // End of variables declaration }
Screen Shots of program:
1.
2.
3.
4.
5.
6.
7.
8.
9.
Coding for Making Table in MySql:
create database Lavish; use Lavish; create Table book ( bcode char(5) unique, bname char(30), amt char(5), QtyA char(5) ); insert into book values(101,"bbc","120","25"); insert into book values(102,"oxford","130","30"); insert into book values(103.,"ip","150","35"); insert into book values(104,"chem","190","40"); insert into book values(105,"phy","200","45"); insert into book values(106,"phe","220","50"); insert into book values(107,"maths","180","55");