Class Xll
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:-
model.addRow(new Object[]{bcode,bname,amt,QtyA});} }catch(Exception e){ JOptionPane.showMessageDialog(null,e.getMessage()); } // TODO add your handling code here: } private void lbtnActionPerformed(java.awt.event.ActionEvent evt) { this.setVisible(false); new Main().setVisible(true);// TODO add your handling code here: } private void bbtnActionPerformed(java.awt.event.ActionEvent evt) { this.setVisible(false); new SaleBook().setVisible(true); // TODO add your handling code here: } /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new AllItem().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JButton abtn; private javax.swing.JButton bbtn; private javax.swing.JTable bookTbl; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JButton lbtn; // End of variables declaration }
private void ebtnActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: this.setVisible(false); new ENDING().setVisible(true); } /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Main().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JButton backbtn; private javax.swing.JButton ebtn; private javax.swing.JLabel jLabel1; private javax.swing.JButton libtn; private javax.swing.JPasswordField pwdFld; // End of variables declaration }
new SaleBook().setVisible(true); }
private void adminbtnActionPerformed(java.awt.event.ActionEvent evt) { this.setVisible(false); new adminpswd().setVisible(true); // TODO add your handling code here: } /** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Menu().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JButton adminbtn; private javax.swing.JButton allitmbtn; private javax.swing.JButton lobtn; private javax.swing.JButton salebtn; // End of variables declaration }
float amt1= Float.parseFloat(amtTF.getText()); float amt = qtyo*amt1; int ans1=JOptionPane.showConfirmDialog(rootPane,"surely wanna purchase?"); TotAmtTF.setText(""+amt); int qty = qtya-qtyo;{ if(ans1 == JOptionPane.YES_OPTION) JOptionPane.showMessageDialog(rootPane,"Book sold.Thankyou for purchasing"); } try { Class.forName("java.sql.Driver"); con=DriverManager.getConnection("jdbc:mysql://localhost/Lavish","root","root"); Statement qry = con.createStatement(); String query = "UPDATE book SET QtyA =QtyA-"+qtyo+" where bcode="+b; qry.executeUpdate(query); } catch(Exception e) { JOptionPane.showMessageDialog(null,e.getMessage()); } } // TODO add your handling code here: } private void loadBtnActionPerformed(java.awt.event.ActionEvent evt) { try { Class.forName("java.sql.Driver"); con=DriverManager.getConnection("jdbc:mysql://localhost/Lavish","root","root"); //JOptionPane.showMessageDialog(this, "ok"); stmt = con.createStatement(); String query = "Select * from book where bcode ="+bcodeTF.getText()+";"; rs = stmt.executeQuery(query); if (rs.next()) { String bcode = rs.getString("bcode"); String bname = rs.getString("bname"); String amt = rs.getString("amt"); String QtyA = rs.getString("QtyA"); bcodeTF.setText(bcode); bnameTF.setText(bname); amtTF.setText(amt); QtyATF.setText(QtyA); } else { JOptionPane.showMessageDialog(null,"No such record found"); bnameTF.setText(""); QtyATF.setText("");
// TODO add your handling code here: } private void lobtnActionPerformed(java.awt.event.ActionEvent evt) { this.setVisible(false); new Main().setVisible(true);// TODO add your handling code here: } private void clearbtnActionPerformed(java.awt.event.ActionEvent evt) { bcodeTF.setText(""); bnameTF.setText(""); amtTF.setText(""); QtyATF.setText(""); QtyOTF.setText(""); TotAmtTF.setText(""); // TODO add your handling code here: } private void backbtnActionPerformed(java.awt.event.ActionEvent evt) { this.setVisible(false); new Menu().setVisible(true);// TODO add your handling code here: } private void QtyATFActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: } private void QtyOTFCaretUpdate(javax.swing.event.CaretEvent evt) { //loadBtn.doClick();
// TODO add your handling code here: } private void TotAmtTFActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: } /** * @param args the command line arguments
*/ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new SaleBook().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JTextField QtyATF; private javax.swing.JTextField QtyOTF; private javax.swing.JTextField TotAmtTF; private javax.swing.JTextField amtTF; private javax.swing.JButton backbtn; private javax.swing.JTextField bcodeTF; private javax.swing.JTextField bnameTF; private javax.swing.JButton clearbtn; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JButton loadBtn; private javax.swing.JButton lobtn; private javax.swing.JButton salebtn; // End of variables declaration }
// TODO add your handling code here: } private void updatebtnActionPerformed(java.awt.event.ActionEvent evt) { int ans = JOptionPane.showConfirmDialog(null,"Surely wanna update the record?"); if(ans == JOptionPane.YES_OPTION){ try{ stmt = con.createStatement(); String query ="Update book set bname ='"+ bnameTF.getText() +"',amt ='"+amtTF.getText()+"',QtyA ='"+QtyATF.getText()+"'WHERE bcode = "+bcodeTF.getText()+";"; stmt.executeUpdate(query); JOptionPane.showMessageDialog(null,"Record successfully updated."); } catch(Exception e) { JOptionPane.showMessageDialog(null,"Error in table updation!"); } }// TODO add your handling code here: } private void addbtnActionPerformed(java.awt.event.ActionEvent evt) { int ans = JOptionPane.showConfirmDialog(null,"Surely want to add record"); if (ans == JOptionPane.YES_OPTION) { try { Class.forName("java.sql.Driver"); con=DriverManager.getConnection("jdbc:mysql://localhost/Lavish","root","root"); stmt = con.createStatement(); String bcode = bcodeTF.getText(); String bname = bnameTF.getText(); String amt = amtTF.getText(); String QtyA = QtyATF.getText(); String strSQL = "Insert into book(bcode,bname,amt,QtyA) values('"+(bcode)+"','"+(bname)+"','"+(amt)+"','"+(QtyA)+"');"; stmt.executeUpdate(strSQL); JOptionPane.showMessageDialog(null,"Record Added!"); bcodeTF.setText(""); bnameTF.setText(""); amtTF.setText(""); QtyATF.setText(""); } catch(Exception e) { JOptionPane.showMessageDialog(null,e.getMessage()); } } // TODO add your handling code here: } private void delbtnActionPerformed(java.awt.event.ActionEvent evt) { int res = JOptionPane.showConfirmDialog(null,"wanna delete the record for sure?");
if (res == JOptionPane.YES_OPTION) { try { stmt = con.createStatement(); String query = "Delete from book where bcode ='"+bcodeTF.getText()+"';"; stmt.executeUpdate(query); JOptionPane.showMessageDialog(null,"Record Deleted!"); } catch(Exception e) { JOptionPane.showMessageDialog(null,"Error in deletion!"); } }// end of if bcodeTF.setText(""); bnameTF.setText(""); amtTF.setText(""); QtyATF.setText("");
// TODO add your handling code here: } private void loadBtnActionPerformed(java.awt.event.ActionEvent evt) { try { Class.forName("java.sql.Driver"); con=DriverManager.getConnection("jdbc:mysql://localhost/Lavish","root","root"); //JOptionPane.showMessageDialog(this, "ok"); stmt = con.createStatement(); String query = "Select * from book where bcode ="+bcodeTF.getText()+";"; rs = stmt.executeQuery(query); if (rs.next()) { String bcode = rs.getString("bcode"); String bname = rs.getString("bname"); String amt = rs.getString("amt"); String QtyA = rs.getString("QtyA"); bcodeTF.setText(bcode); bnameTF.setText(bname); amtTF.setText(amt); QtyATF.setText(QtyA); } else { JOptionPane.showMessageDialog(null,"No such record found"); bnameTF.setText(""); QtyATF.setText(""); amtTF.setText(""); } } catch(Exception e) { JOptionPane.showMessageDialog(null,e.getMessage()); }
/** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new admin().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JTextField QtyATF; private javax.swing.JButton addbtn; private javax.swing.JTextField amtTF; private javax.swing.JTextField bcodeTF; private javax.swing.JTextField bnameTF; private javax.swing.JButton clearbtn; private javax.swing.JButton delbtn; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JButton loadBtn; private javax.swing.JButton lobtn; private javax.swing.JButton updatebtn; // End of variables declaration }
new Menu().setVisible(true); }
/** * @param args the command line arguments */ public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new adminpswd().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JButton backbtn; private javax.swing.JLabel jLabel1; private javax.swing.JButton libtn; private javax.swing.JPasswordField pwdFld; // End of variables declaration }
2.
3.
4.
5.
6.
7.
8.
9.
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");