I.P Project Report CLASS XII CBSE
I.P Project Report CLASS XII CBSE
Acknowledgement
I would like to express my sincere gratitude to my I.P. teacher
Mr. RAVINDRA KUMAR Sir for his vital support, guidance and
-PRIYANSHU KUMAR
2
3
INDEX
S.NO TITLE P NO.
1. ABSTRACT 4
2. INFORMATION ABOUT JAVA 5
3. INFORMATION ABOUT MySQL 6
4. SYSTEM REQUIREMENTS 7
5. GUI AND PROGRAMMING 8 -47
6. DATABASE DETAILS 48-50
7. SCREENSHOTS 51-56
8. BIBLIOGRAPHY 57
4
Abstract
Introduction:
This Project is based on the topic library management. I have used
MYSQL (a DBMS software) and JAVA (general-
purpose programming language for creation of GUI) to create a
user friendly data management software which helps us to mange
data required to maintain a library.
Software requirements: -
Hardware requirements: -
Monitor
Mouse
Keyboard
RAM: 512 MB or more
HDD storage: 256 GB or more
Processor: P4 or higher
Micro Processor: intel Pentium (quad core) or higher
8
9
MAIN_HOME
LOGIN_FORM REGISTERATION_FORM
HOME
CUSTOMER PROVIDER
BOOK_SEARCH RENT
10
BOOK_ADDITION
lgf.setLocationRelativeTo(null);
lgf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.dispose();
String url="jdbc:Mysql://localhost/LIBRARY_MANAGER";
String user="root";
String pwd="XIB35";
String fname=t1.getText();
String lname = t2.getText();
String uname = t3.getText();
String pass = String.valueOf(p2.getPassword());
String re_pass = String.valueOf(p1.getPassword());
String address = ta.getText();
if(uname.equals(""))
{
JOptionPane.showMessageDialog(null, "Add A Username");
}
else if(pass.equals(""))
{
JOptionPane.showMessageDialog(null, "Add A Password");
}
else if(!pass.equals(re_pass))
{
JOptionPane.showMessageDialog(null, "Retype The Password
Again");
14
}
else if(checkUsername(uname))
{
JOptionPane.showMessageDialog(null, "This Username Already
Exist") }
else{
PreparedStatement ps;
String query = "INSERT INTO LIBRARY_USERS VALUES(?,?,?,?,?)";
try {
Connection con=DriverManager.getConnection(url,user,pwd);
ps = con.prepareStatement(query);
ps.setString(1, fname);
ps.setString(2, lname);
ps.setString(3, uname);
ps.setString(4, pass);
ps.setString(5, address);
if(ps.executeUpdate() > 0)
{
JOptionPane.showMessageDialog(null, "New User Added");
}
15
try {
Connection con=DriverManager.getConnection(url,user,pwd);
ps = con.prepareStatement(query);
ps.setString(1, username);
rs = ps.executeQuery();
if(rs.next())
{
checkUser = true;
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(this,ex.getMessage());
}
return checkUser;
}
Code for “CANCEL” button :-
System.exit(0);
17
String url="jdbc:Mysql://localhost/LIBRARY_MANAGER";
String user="root";
String pwd="XIB35";
String uname = t1.getText();
String pass = String.valueOf(p1.getPassword());
String query = "SELECT * FROM LIBRARY_USERS WHERE
USER_NAME =? AND PASSWORD =?";
try {
Connection con=DriverManager.getConnection(url,user,pwd);
ps = con.prepareStatement(query);
ps.setString(1, uname);
ps.setString(2, pass);
rs = ps.executeQuery();
if(rs.next())
{
HOME mf = new HOME();
mf.setVisible(true);
mf.pack();
mf.setLocationRelativeTo(null);
mf.setExtendedState(JFrame.EXIT_ON_CLOSE);
this.dispose();
}else
19
{
JOptionPane.showMessageDialog(null, "Incorrect Username Or
Password", "Login Failed", 2);
}
cr.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.dispose();
Code for “PROVIDER” button:-
PROVIDER pr = new PROVIDER();
pr.setVisible(true);
pr.pack();
pr.setLocationRelativeTo(null);
pr.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.dispose();
Code for “LOGOUT” button:-
MAIN_HOME mh = new MAIN_HOME();
mh.setVisible(true);
mh.pack();
mh.setLocationRelativeTo(null);
mh.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.dispose();
code for “EXIT” button:-
System.exit(0);
22
this.dispose();
mh.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.dispose();
String pub="%"+t3.getText()+"%";
String yoi="%"+t4.getText()+"%";
String genre=String.valueOf("%"+cb1.getSelectedItem()+"%");
String a = null;
String b="welcome";
if(rb1.isSelected())
{
a = "b_name"+" "+"like"+" "+"\""+"%"+t1.getText()+"%"+"\"";
}
else if(rb2.isSelected())
{
a = "author"+" "+"like"+" "+"\""+"%"+t2.getText()+"%"+"\"";
}
else if(rb3.isSelected())
{
a = "yoi"+" "+"like"+" "+"\""+"%"+t4.getText()+"%"+"\"";
}
else if(rb4.isSelected())
{
a = "publication"+" "+"like"+""+"\""+"%"+t3.getText()+"%"+"\"";
}
27
else if(rb5.isSelected())
{
a = "genre"+" "+"like"+" "+"\""
+String.valueOf("%"+cb1.getSelectedItem()+"%")+"\"";
}
else if(rb6.isSelected())
{
a = "b_id"+"="+t5.getText();
}
String query = "select b_id,b_name,author,yoi,publication,rent_price,”
+“genre from book_details where"+" "+a;
try {
Connection con=DriverManager.getConnection(url,user,pwd);
Statement stm = con.createStatement();
rs=stm.executeQuery(query);
while(rs.next()){
String bid=rs.getString("b_id");
String bname=rs.getString("b_name");
String AUTHOR=rs.getString("author");
String YOI=rs.getString("yoi");
String publication=rs.getString("publication");
String rp=rs.getString("rent_price");
28
String GENRE=rs.getString("genre");
model.addRow(new Object[]
{bid,bname,AUTHOR,YOI,publication,rp,GENRE});}
rs.close();
stm.close();
con.close();
}catch (SQLException ex) {
JOptionPane.showMessageDialog(this,ex.getMessage());
}
Code for radio button “BOOK NAME” :-
t1.setEditable(true);
t2.setEditable(false);
t3.setEditable(false);
t4.setEditable(false);
t5.setEditable(false);
cb1.setEditable(false);
t1.setText("");
t2.setText("");
t3.setText("");
t4.setText("");
t5.setText("");
DefaultTableModel model=(DefaultTableModel)TABLE.getModel();
29
model.setRowCount(0);
Code for radio button “AUTHOR” :-
t1.setEditable(false);
t2.setEditable(true);
t3.setEditable(false);
t4.setEditable(false);
t5.setEditable(false);
cb1.setEditable(false);
DefaultTableModel model=(DefaultTableModel)TABLE.getModel();
model.setRowCount(0);
t1.setText("");
t2.setText("");
t3.setText("");
t4.setText("");
t5.setText("");
Code for radio button “EDITION” :-
t1.setEditable(false);
t2.setEditable(false);
t3.setEditable(false);
t4.setEditable(true);
t5.setEditable(false);
30
cb1.setEditable(false);
DefaultTableModel model=(DefaultTableModel)TABLE.getModel();
model.setRowCount(0);
t1.setText("");
t2.setText("");
t3.setText("");
t4.setText("");
t5.setText("");
Code for radio button “PUBLICATION”:-
t1.setEditable(false);
t2.setEditable(false);
t3.setEditable(true);
t4.setEditable(false);
t5.setEditable(false);
cb1.setEditable(false);
DefaultTableModel model=(DefaultTableModel)TABLE.getModel();
model.setRowCount(0);
t1.setText("");
t2.setText("");
t3.setText("");
t4.setText("");
31
t5.setText("");
Code for radio button “GENRE” :-
t1.setEditable(false);
t2.setEditable(false);
t3.setEditable(false);
t4.setEditable(false);
t5.setEditable(false);
cb1.setEditable(true);
DefaultTableModel model=(DefaultTableModel)TABLE.getModel();
model.setRowCount(0);
t1.setText("");
t2.setText("");
t3.setText("");
t4.setText("");
t5.setText("");
Code for radio button “BOOK ID” :-
t1.setEditable(false);
t2.setEditable(false);
t3.setEditable(false);
t4.setEditable(false);
t5.setEditable(true);
32
cb1.setEditable(false);
DefaultTableModel model=(DefaultTableModel)TABLE.getModel();
model.setRowCount(0);
t1.setText("");
t2.setText("");
t3.setText("");
t4.setText("");
t5.setText("");
re.setLocationRelativeTo(null);
re.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.dispose();
code for “BACK” button :-
CUSTOMER cr = new CUSTOMER();
cr.setVisible(true);
cr.pack();
cr.setLocationRelativeTo(null);
cr.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.dispose();
Code for “LOGOUT” button :-
MAIN_HOME mh = new MAIN_HOME();
mh.setVisible(true);
mh.pack();
mh.setLocationRelativeTo(null);
mh.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.dispose();
Code for “EXIT” button :-
System.exit(0);
34
String b_id=t2.getText();
if(u_name.equals(""))
{
JOptionPane.showMessageDialog(null, "Enter Username");
}
else if(b_id.equals(""))
{
JOptionPane.showMessageDialog(null, "enter book id");
}
else if(checkUsername(u_name))
{
JOptionPane.showMessageDialog(null, "This Username doesn't
Exist");
}else{
if(checkBook(b_id))
{
JOptionPane.showMessageDialog(null, "This book id doesn't
Exist");
}else{
String query="insert into rent_details values(?,?)";
36
try {
Connection con=DriverManager.getConnection(url,user,pwd);
ps=con.prepareStatement(query);
ps.setString(1,u_name);
ps.setString(2,b_id);
if(ps.executeUpdate() > 0)
{
JOptionPane.showMessageDialog(null, "rent successful");
}
}catch (SQLException ex) {
JOptionPane.showMessageDialog(this,ex.getMessage());
}
}
}
Code for “SEARCH BOOK” button :-
BOOK_SEARCH bs = new BOOK_SEARCH();
bs.setVisible(true);
bs.pack();
bs.setLocationRelativeTo(null);
bs.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.dispose();
37
if(rs.next())
{
checkUser = false;
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(this,ex.getMessage());
}
return checkUser;
Code for “EXIT” :-
System.exit(0);
40
String pub=T3.getText();
double price;
String genre=String.valueOf(cb1.getSelectedItem());
if(name.equals(""))
{
JOptionPane.showMessageDialog(null, "Add A Name");
}
else if(author.equals(""))
{
JOptionPane.showMessageDialog(null, "Add A Author");
}
else if(yoi.equals(""))
{
JOptionPane.showMessageDialog(null, "Add A Edition year");
}
else if(pub.equals(""))
{
JOptionPane.showMessageDialog(null, "Add A Publisher");
}
else if(T4.getText().equals(""))
{
44
ps.setString(4,pub);
ps.setString(5,p);
ps.setString(6,genre);
ps.setString(7,r);
if(ps.executeUpdate() > 0)
{
JOptionPane.showMessageDialog(null, "New book Added");
}
}catch (SQLException ex) {
JOptionPane.showMessageDialog(this,ex.getMessage());
}
}
Code for checkBook Boolean:-
String url="jdbc:Mysql://localhost/LIBRARY_MANAGER";
String user="root";
String pwd="XIB35";
PreparedStatement ps;
ResultSet rs;
boolean checkUser = false;
String query = "SELECT * FROM book_details WHERE B_NAME =? &&
AUTHOR=? && YOI=?";
try {
46
Connection con=DriverManager.getConnection(url,user,pwd);
ps = con.prepareStatement(query);
ps.setString(1, name);
ps.setString(2, author);
ps.setString(3, yoi);
rs = ps.executeQuery();
if(rs.next())
{
checkUser = true;
}
} catch (SQLException ex) {
JOptionPane.showMessageDialog(this,ex.getMessage());
}
return checkUser;
Code for “BACK” button:-
PROVIDER pr = new PROVIDER();
pr.setVisible(true);
pr.pack();
pr.setLocationRelativeTo(null);
pr.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.dispose();
47
Database name:
LIBRARY_MANAGER
Table names:
BOOK_DETAILS
RENT_DETAILS
LIBRARY_USERS
BOOK_DETAILS:
RENT_DETAILS:
LIBRARY_USERS:
Registration form
53
Login_form
54
Book_Search
55
Rent
56
Book_addition
57
BIBLIOGRAPHY
WEBSITES USED:-
http://www.wikipedia.com
http://www.wikihow.com
BOOKS USED:-