BCA Minor Project
BCA Minor Project
BCA Minor Project
TABLE OF CONTENTS
Content Page No.
1. Declaration 3
2. Certificate 4
3. Acknowledgement 5
4. Abstract 6
5. Introduction of the Project 7
6. Objectives of the Project 8
7. Hardware and Software Requirements 9
8. Project Analysis & Designing 10
- DFD
- ER Diagram
9. Input / Output Screenshot 12
10. Coding 20
11. Testing 50
12. Future Scope 52
13. References 53
DECLARATION
I, Ashutosh, bearing roll number
201110106021, hereby declare that the work which is being
presented in the Minor Project, entitled "Library Management System" in partial
fulfillment
for award of Degree of "Bachelor of Computer Applications" in Department of
Computer
Application is submitted under the Guidance of
"Mr. Manoj Kumar".
I have not submitted the matter presented in this work anywhere for the award of
any other
Degree.
Date:
Student Name: Ashutosh
Roll No.:
201110106021
CERTIFICATE
Certified that the Project Report entitled "Library Management System"
submitted by
Ashutosh bearing roll no 201110106021 in partial fulfillment of the requirements
for the award
of the degree of Bachelor of Computer Applications is a record of the student's own
work carried
out under my supervision and guidance. To the best of our knowledge, this Minor
Project work
has not been submitted anywhere for the award of any other Degree.
It is further understood that by this certificate the undersigned does not endorser
approve of any
statement made, opinion expressed or conclusion drawn therein but approve Minor
Project for
the purpose for which it is submitted.
Mr. Manoj Kumar
Mr. Lalit Kumar
(Project-Coordinator)
(HOD, BCA Deptt.)
ACKNOWLEDGEMENT
Many people have supported me, in different ways, during the work with the minor
project. I'd
like to thank my guide Mr. Manoj Kumar & HOD Mr. Lalit Kumar for their kind and
active
support and valuable guidance during the work process. My family has, as always,
offered me
their unconditional support, during my efforts in completing this Minor Project.
However, it would not have been possible without the kind support of many
individuals and
institution.
I would like to extend my sincere thanks to each and every member related to MIT
(PC).
Student Name : Ashutosh
BCA Vth Sem
Roll No. :
201110106021
ABSTRACT
Online Library Management System is a system which maintains the information
about the books present in the library, their authors, the members of library to
whom
books are issued and all. This is very difficult to organize manually. Maintenance
of
all this information manually is a very complex task. Owing to the advancement of
technology, organization of an Online Library becomes much simpler. The Online
Library Management has been designed to computerize and automate the operations
performed over the information about the members, book issues and returns and all
other operations. This computerization of library helps in many instances of its
maintenance. It reduces the workload of management as most of the manual work
done is reduced.
INTRODUCTION
The project "Library Management System" is developed in Java with the help of
AWT and Swing packages , which mainly focuses on basic operations in a library like
adding new member, new books, and updating new information books and
members and facility to issue and return books. Using this application librarian
can
issue and return books easily also with this user can add new books easily.
This System application is reduced as much as possible to avoid errors while
entering data. It
also provides an error message while entering invalid data. It is user-friendly as
no formal
knowledge is required to use the system.
The software keeps track of all the information about the books in the library,
their cost, their
complete details and total number of books available in the Library. The user will
find it easy in
this automated system rather than using the manual writing system. The system
contains a
database where all the information will be stored safely. The system is user-
friendly and error
free.
ERD
it,imk; Ad min
C
Fig . Library Management System
SCREENSHOTS
Home page :-
This is the home page of the library management system . There are two sections:
Admin login
and Librarian login.
Login page
Library Management
Admin Login
(Login
Librarian Login
Login
Admin Login
After clicking on admin login the following window opens which ask name of admin
and
password of admin.
Admin Login page
— ❑ X
Admin Login
Name
admin
Password
Login
Cancel
Admin Section
After login with correct details the admin section open there are different option
for admin which
includes :-
1.Add Info -> Add Librarian
2. View Info -> View Librarian
3. Delete Info -> Delete Librarian
4. Exit -> Logout
LAL Admin Section
— ❑ X
Add Info View Info Delete Info Exit
Add Librarian
By clicking on Add Info admin can add a new Librarian by filling this information.
114 Add Librarian
0 X
Add Librarian
Name
Arun
Password
E-mail
arun@l23gmail.com
Contact
4578121212
kddress
10, XYZ colony
City
Meerut , UP
Add Librarian
Cancel
View Librarian Information
If admin successfully add librarian with correct details .admin can see all the
librarian by
clicking on View Info.
111.. Librarian Information
❑ X
ID
Name password E-mail Contact Address
City
1
Kapi I pass123 Kapi101@gmail.com6746234283
10,X Street2 Col... Meerut
2
Anoop pass123 Anoop01@grnail.c...2348367375
11,X Street,Z Col... Meerut
5
Arun pass123 arung123grnail.c...4578121212 10,
XYZ colony Meerut , UP
1
Delete Librarian
I Delete
View Librarian Information
After successfully deleting the librarian the View Info window automatically open
and show the
current librarian.
Libman Information
❑ X
Librarian Login
In the home page if you click on librarian login the following window opens . Here
librarians can
login with a name and password which is set by the admin.
Librarian Login, page
0
Librarian Login
kapil
"
s's's
Cancel
Librarian Section
After successfully entering the data librarian section open . Here librarian can
perform different
task like :-
1.Add Info -> Add Books
n Section -
A
dd Info View Info Issue Info R eturn Exit
111
ifitA
M\ L\
I
N
- -
Add Book
Librarians can add book by clicking on Add Info and filling the following details .
Add Book
❑ X
Add Book
Book No
6
Book Name
java
Author
E balaguru swami
Publisher
BP publications
Quantity
Librarian can see the available books by clicking on View Info -> View Books
VPEW Book Information
❑ X
Issue Book
Librarians can issue the books by clicking on Issue Info and provide this
information .
1=1 Issue Book Section
0 X
Issue Book
Book Id
I
Book No
6
Book Name
java
Student Id
21
Student Name
Ashutosh
Student Contact
763847111
Book Quantity
50
Issue Book
Cancel
View Book Information
Librarians can view book by clicking on View Issue Book.
Return Book
Librarians return the issue book by clicking on Return Info and provide the
following
information.
I Return Book
❑ X
Return Book
I
-Book No
6
!Student Id
21
CODING
In this project there are classes used which perform different functions.
1. Connection.Java
package Library;
import java.sql.*;1
public class ConnectionClass
Connection con;
Statement stn;
ConnectionClass()
try
Class.forName{"com.mysql.d.jdbc.Driver");
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/
Library","root","pass123");
stmcon..createStatement();
if(con.isClosed())
SystPx.out.println("Not Connect");
else
Sys-t4mn .out.println("Connect");
catch( Exception e)11
e.printStackTrace();
public static void main(StringEl args)
new ConnectionClass();
}
2.Indexjava
2 package Library;
3 v import java.awt.event.*;
4 import java.awt.1;
5 import javax.swing.*;
6 v public class Index
extends 'Frame implements ActionListenert
7 Rabe]. 11,12,13314;
Button bt1,bt2;
9 ]Panel p102„p3;
10 Font f,f1;
Ll
12 v Index()
13 sup
."("Login page—;
14
setLocaticmC400,200.1;
15
setSize%500,200);
16
17 f=neu Font "Aria1'„Font.BOLD,25);
18 f1iew Font"Arial",Font.DOLO,20);
19 11=new habelrAdmin Login");
20 12=new habel("Librarian Login");
21 13=new habelj"Library Management");
22 btl=new ButtonffLoginm);
23 ht2=ney Button."Login");
24 Ibti.addActionListeneri7ris);
25 ht2.addActionListener.—:: ;
26
27 ImageIcon img = nev;
ImageIcoOdassLoader.getSystemResource("icon/imgl.jpg"));
28 Image
i=img.getImage .get5caledInstance'130,120,Image.51ALLDEFAULT
;
29 ImageIcon img2=new Imagelcomi.;
39 ]A=new hatie1dmg2:;
31
32 11.setFont.f1;.;
33 12.setFont•F1.;
34 13.setFont.f;;
35 titi.setFontj1.;
36' tit2.setFontj1.;
37
38 13.setHorizontalAlignmenthabel.CENTER);
39 13.setForeground(Color.white);
AO 11.setForeground(Color.RED);
41 12.setForeground(Color.REDfl
42 btl.setForeground{Color.BLUE
;
43 bt2.setForeground(Color.BLUE
;
44
45 pl=new ]Panel;;;
46 pl.setLayoutOiew
6ridLayout(2,2,10,10));
47 pl.add 11:;
48 pl.add btli;
49 pl.add 12';
50 pl.add bt2,;
51
52 p2=new ]Panel.
53 p2.setLayoutnew 6ridLayout(1,1,10,10)
;
54 p2.add.14:;1
55
56 p3=new 3Panel,
,;
57
p3.setLayout new 6ridLayout(1,1,10,10)
58
p3.setBackground(Color.black);
59 p3.add L3 ;
60
61
62
setLayout(new BorderLayout(10,10) ;
63
addp3,"North"
64 add:;
;2,"West":;
65
addp1,"Center");
66
67
68
69 public
void actionPerformed(ActionEvent e)
70 f
71 if
e.get5ource()==btl)
72
73 System.out.println("Admin login");
74 new Admin().setVisible(true);
75 this.setVisible(i.31se);
76 }
77 W e.get5ource()==bt2,
78
79 System.out.println("librarian login");
80
81 new Librarian().setVisible(true);
82 tnis.setVisible( :else);
83
84
85
86
87
88 public static void main(String[] args)C
89 new Index().setVisibletrue);
90 }
91 )
92
93
4. Admin.java
41 12.setForegrnund(Color.dark6ray);
42 13.setForeground(Color.dark8ray);
43
44 pl=new
]Panel();
45
pl.setLayoutinew GridLayout(1,1,10,10)};
46 p1.add(11);
47
pl.setBackground(Color.OLUE);
48 p2 ew
3Pane1();
49
p2.setLayout(new 6ridLayout(3,2,10,10));
50 p2.add 12);
51 p2.add tfl);
52 p2.add 73
;
53 p2.add:sof1);
54 p2.add(bt1);
55 p2.ad (bt2);
56
57 setLayout•new BorderLayout(10,10):;
58 add p1,11orth"h1
59 add p2,"Center");
69 }
61 public void actionPerformed(ActionEvent e)
62
63 String name-tfl.getText();
64 String pass=pf1.galsztra;
65
66 if(e.get5ource()==bt
67
fO try
69
79 Connectiontlass obj=new Connectiontlass();
71 String s-'select username,password from adnin where
username=—+nane."' and password=—+pass+ — ;
72 Result5et rest=obj.stm.executeQuery(s);
73 if(rest.next0)
74
75
System.out.printlnrAdmin Section";;
76 new
AdninSectionO.setVisible(true);
77 this.setVisiblel'alse ;
78
79 else
SO
sl M
otionPane.showMessageDialog(null,"drung-);
92 this-setVisible
93 this-setVisible t.rue);
94 }
95
96 catch(Exception ee)
97
B8 ee.primtStackTrace();
89 }
90
91
92 if.:e.getSoorce()==bt2)
93
94 this.setVisible(false);
95 }
96
97
98
99
Ise public static void main(String[] arg )f_
221 new Admin().setVisible<true);
102
1E13
104
105
5. AdminSection.j ava
6 public class AdminSection
extends ]Frame implements ActionListenerf
7 3Labe1 11;
8 ]Panel pl,p2;
9 Font f,f1;
10 AdminSection()
11
12 super("Admin Section");
setLocation(0,0);
14 setSize(1500,800);
15 f=new Fonti„"Aria1",Font.0010,25);
16 fl=new Font("Arial"„Font.BDUD,20);
17 ImageIcon lug
= new ImageIcoWClassLoader.getSystemResource iconifirst.jpell;
18
Image i=img.getImage. .getScaledInstance(1500,800,1mage.SCALE DEFAULT);
19 ImageIcom img2=new ImageIcon
i ;
20 11=new Label img2,;
21 )Menular ml=new
JMenuBar ;
22 }Menu menl=new Mienu("Add Info");
23
)MenuItem mentl=new MienuIteC"Add Librarian");
24 ]Menu men2=new Menu,"View Info");
25
JMenuItem ment2=new MienuIteC"View Librarian");
26 ]Menu men3=new Menui"Delete Info");
27
JMenuItem ment3=new MienuItem("Delete Librarian");
28 ]Menu men4=new Menu,'"Exit");
29 ]MenuItem
ment4=new ]MenuItemMogout");
30 menl.add(mentf,;
31 men2.addment2',;
32 men3.adth.ment3',;
33 men4.addOment4.,;
34 mi.adcYment;
35 ml.addCmenZ;
36 ml.addmen3 ;
37 ml.addCmen4 ;
38 menl.setFont(.f);
39 men2.setFont..f);
40 men3.setFont(f);
41 men4.setfont(f);
42 mentl.setFontf);
43 ment2.setFont(f);
44 ment3.setFont(f);
45 ment4.setForrh-F:;
46 menti.addActionListener(this);
47 ment2.addActionListener(this);
48 ment3.addActionListener(this);
49 ment4.addActionListener(this);
50 set]MenuBarfml.;;
51 addA.1
52
53
54 public void ac tionPerformed(ActionEvent e)
55
56 String comd-e.getActionCommand();
57 if(comd.equals("Add Librarian")1
56
59 System.out.drintln("Add");
'60 new AddLibrarian().setVisible(true);
'61
62 else if(cowd.equals("View Librarian"))
63
64 System.aut.println(Niewl;
65 new ViewLibrarian().setVisible(true);
66 it
67 else i-Pcomd.equals("Delete Librarian")}
68
69 System.out.println("Deleter);
70 new DeleteLibrarian().setVisible(true);
72
72 else ifftord.equals("Logout"))
/3
74 System.aut.println("logowt");
75 System.exit(0);
76 1
77
78
79
BO public static void main(String[] ergs) L
81 new AdminSectioW)..setVisible(true};
B2 I51
83
6. AddLibrarian.java
1 package Library;
2 import java.awLevent.*;
3 import java.awt..*;
4 import javax.swing.*;
5
6 public class AddLibrarian -.tends
]Frame implements ActionListeneri
7 Rabel 11,12,13,14,15,16,17;
8 ]TextField tfl,tf3,t-f4,tf5,tf6;
9 Passwordfield pf2;
10 Panel pljp2;
11 ]Button trtl,bt2;
12 Font f,f1;
13
14 AddLibrarian()
33
16 superl."Add Librarian");
17 setLocationi4400,2001;
18 setSiz&,650,4400i;
19 f=new
FontrArial"„font.600225);
20 f1=new
font("Aria1",forft.8O1.0,20);
21 11
ew JiabelrAdd Librarian');
12 ew JLabelrName"J;
23 13=nei
Rabel('Passward");
24 14=new Label("E-mail");
25 15=new Label("Contact".q.
26 16=new Label("Address"
;
27 17=new Rabel("City");
28 bti=new Button("Add
Librarian")i
29 bt2=new Button("Cancelm);
30 tfl=new HertField();
31 pf2=new PasswordField
32 tf3=new HertField();
33 tf4=new iTertField0;
34 tf5=new HertField();
35 tf6=new iTextFie/d();
36
37 11.setFont(f);
38 12.setFont(f1);
39 13.setFont'fl:;
40 14.setFont'fl];
41 15.setFont fl.;
42 16.setFont fl.;
43 17.setFont fl
44 tfl.setFontsfl ;
45 tf3.setFont:f1 ;
46 pf2.setFont fl ;
47 tf4.setFont fl ;
48 tf5.setFont fl ;
49 tf6.setFont fl ;
50 btl.setFont fl ;
51 btl.setFont fl ;
52 bti.addoictionastener,tnis);
53 bt2.addActionListener•this);
54 11.setHorizontalAlignment(nabe1.CENTER).;
55 11.setForegroundiColor.WHITE);
56
57 pl=new Panel. ;
58 pl.setLayoutnew
6ridlayout(1,1,10,10));
59 pl.add 11 ;
60
pl.setBackground(Color.BLUE);
61 p2=new Panel ;
62 p2.setLayoutnew
5ridlayout(7,2,10,10));
63 p2.add 12 ;
64 p2.add tfl
65 p2.add 13 ;
66 p2.add oft ;
67 p2.add 14 ;
68 p2.add tf3 ;
69 p2.add 15 ;
70 p2.add tf4 ;
71 p2.addk16';
72 p2.add(tf5);
73 p2.add(17);.
74 p2.add(tf6);
75 p2.add(btl);
75 0.add.titi ;
76 p2.add.6t2.;
77
78
setLayoutknew BorderLayout(10,10) ;
79 add pl,"North" ;
80 add
p2,"Center");
82
E3 public
void actionPerformed(ActianEvent e)
84
85 String
name=tfl.getText ;
E6 String
pass=pf2.AntTcxt ;
87 String
email=tf3.getTexti);
88 String
contact=tf4.getTextc
89 String
addtf5.getText();.
90 String
city=tf6.getTexte};
91
92
if,;e.getSource()==bti)
93
94 try 5
99
ConnectionClass obj=new ConnectionClassC);
96
String q="insert into librarian(Neme,Password,Email,Cnntact,Address,Citv)
values('"
97
i-name+—,'"+pass-9--,'"+email+—,'"4-contact+—,'"A-add+—,'"A-city±—)";
98
int aa=obj.stm.executeUpdate(q.);
99 if(aa==1)
lag
101
30ptionPane.showoMessageDialognJ11,"Inserted Succesfully");
182
183 1
104 else
105 {
183
JOptionPane.showMessageDialog(null,-Something Wrong I!! Insert data Correctly ");
187
this..setVisible'7
188
109
110
111
catch(Exception ee)[
112
ee.printStackTrace();
112
ee.printStackTrace();
113
114
115
11.6 if-(e.getSource()==bt2)
117
11'a -1-!- —setVisible(1=alse);
119
120
121
122 public s:tatic void main(Strings) args)c
123 new AddLibrarian().setVisible;true,;
124
125
126
7. View Librarian.java
1 :)ackage Library;
2 import java.awt..*;
3 import javax.swing.*;
4 import java.sql..*;
5
6 public class ViewLitorarian extends ]Frame
{
7
String x(]=r1D","Name",npassword","E-mail"„"Contact","Address","City"T;
]Button hts,
0 String y[][]=new String[20][7];
10 int i=0,j=0;
11 ]Table t;
12 Font f,f1;
13 ViewLibrariane,
14 {
15 super("Librarian Information");
16 setlacation(50,78);
17 setSize(1808,400);
la f=new Font 'Arial",font.BOL6,15);
19 try
20
21 ConnectionClass
obj=new ConnectionClass();
22 String ci="select * from Librarian";
23 ResultSet rest
=obj.stm.executecuery(q);
24 while(rest.next())
25
26 y[i][j++]=rest .getString("id");
27 yEii[j++]
=rest .getString("Hame");
28 YLini+
+]=rest .getString("Password");.
29 y[i][j+
+]=rest .getString("Email");
38 y[i][j++]
=rest .getString("contact");
31 y[i][j+
+]=rest .getString("Address");
31 y[i][j+
+]=rest .getString("City");
33 i++;
3.1 jai
35 }
36 t=new iTable(y,x);
37 t.setFont(f);
38
tatch(Exc ption ex)
40
41 ex.printStackTrace();
42
43 ]ScrollPane sp=iew 3ScrollPane t
44 add(s0;
45
46 public static void
main(StringE. args)=
47 new ViewLibrarian().setVisible
43
443 }
50
8. DeleteLibrarian.java
1 package
Library;
2 impart
java.amtmevent.*;
3 Import
java.aut.*;
4 import
lavaxmswing.*;
import java.sql_*;
6
7 public
class DeleteLibrarian extends 3Frame implements ActionListeneri
8
String x[]4"11:1","Name","password",mE-mail","Contact","Address","Cityml;
10 Mutton
btl;
11
String y[][]=new String[20][7];
12 int
i=0,j=0;
13 :Label
11;
14 Tfable
t;
15 Font
f,f1;
16
7TextField tf1;
17 :Panel
pl.;
18
DeleteLibrarian()
19
20
super("Delete Librarian information");
21
setLocation■50,701;
22
setSizej000,400:;
23 f=new
Fon-WrAria1",Font.BOLD,15);
24 try
25 {
26
ConnectionClass Dbj=new ConnectionClass();
27 String
q="select * from Librarian";
23
ResultSet rest =obj.stm.executecuery(q);
29
while(restmnext())
36 {
31 y[i][j+
+]=rest .getString("id');
32 y[i][j+
+]=rest .getStringOlame");
33 y[i][j+
+]=rest .getString("Password");
34 y[i][j+
+]=rest .getString("Email");
19 y[i][j+
+]=rest .getString("contact");
36 y[i][j+
+]=rest .getString("Address");
37 y[i][j+
+]=rest .getString("City");
38 i++;
39
40
41
42 t=new ]Table(y,x);
43 t.setFont(f);
44
45
45 catch(Exception ex.
47
48 ex.printStackTrace();
49
50
51 3ScrollPune sp=new JScrollPanetJ;
52
53 11=new JLabel("Delete Librarian":;
54 tfl=new 31extField(
55 trtl=new 3Buttoni"Delete");
56 trti.addActionlistener(this ;
57 11..setFont.:f);
58 tfl.setFont(f ;
59 hti.setFont(f
60 pl=new Wanel:,;
61 pl...setlayoutinew GridLayout(1,3,10,10)';
62 pl.add'11.;
63 pl.add.tfl);
64 pl.addJrt1);
65
66 setLayoutfnew BorderLayout(10,10));
67 add sp,"Center");
68 add p1,"South");
69 add.sp.;
70
71
72 public void actionPerformedlActionEvent e)
73
74 if(e.get3ource()=1:rt1)
75 !:
67 adcRsp,"Ceater");
68 add(p1,"5outh");
69 adcKsp);
70 }
71
72 public void actionPerforned(ActionEvent e)
73
74 i-Ce.getSource()==bti)
75
76 int id=Integer.parseInt(tfl.getText());
77 try
78
79 ConneetionClass obj=new Connectiontlass();
80 String q="delete fror Librarian where id='"+id+"'";
81 int res=obj.str.executeUpdate(q);
82 if(res==1)
83
84 7OptionPane.shoelessageDialog:.null,"Sucessfully Deleted");
85 tbis.setVisibleitrue);
86 new DeleteLibrarianO.setVisible(true);
87 1
88 else
89
90 300tionPane.showMessageDialog(null,"Something Wrong I!! Please Try
Again");
91 this.setVisibleftrue);
91 new DeleteLibrarian().setVisible(true);
93 1
94 1
95 catch(Exception ex)
96
97 ex.printStackTracek ;
93
99
100 1
101
102 public static vaid maine,StringE] ergs)
103 new Deletelibrariam).setVisible(true);
1014
9. Librarian.j ava
13 panic class Librarian extends ]Frame implements
ActionListener{
14 Rabe' 11,12,13;
15 Button btlibt2;
16 Panel pl,p2;
17 llertField tfl;
16 Passwordfiell pf1;
19 Font f,f1;
20 Librarian()
21
22 suiper("Librarian Login
page");
23 setalcation 400,200);
24 setSize 500,200);
25 f=new
FontC"Arial",Font.BOLD,25 ;
26 fl=new Font
"Aria1',Font.DOLD,201;
27 11=new habel("Librarian
Login");
28 12=new habell'Hame");
29 13=new habel?"Passuord");
30 btl=new Button"Login");
31 bt2=new Button"Cance1"1;
32 bti.addActionListener.7±:.
;
33 bt2.addActionlistener
-' 1.
34 tfl=new 3TextField
35 pfl=new Passwordfield
;
36 11.setFont f
37 12.setFont -F1.;
38 13.setFont fl.;
39 bti.setFont fl
40 bt2.setfont
41 tfl.setfont fl);
42 pfl.setfont.11);
43
44
11.setHorizontalAlignment0Labe1.CENTER);
45 11.setForegroundiColor.WHITE);
46
12.setFpregroundiColor.darkGray);
47
13.setForeground(Color.dark6ray);
48 pl=nepi Panell);
49
pl.setLaypu-Lnew EridLayout(1,1,10,10):;
50 pl.add.11:;
52 pl.set3ackground(Color.8LUE);
52 p2=new ]Panel(];
53 p2.setLayont(new 6ridLayout(3,2,18,10) ;
54 p2.adel2);
55 p2.add(tf1);
56 p2.ade13);
57 p2.add(pf1);
58 p2.add(bt1);
59 p2.add(bt2);
60 setLayout!new BorderLayout(10,10):;
61 add,p1,"North—,.;
62 add,p2..."Center");
63
64 public void actionPerformed(ActionEvent e)
65
66 String name=tfl.getText();
67 String pass=pfl.getToxt();
68
69 if(e.getSource()==btl)
70
71 try
72
71 ConnectionClass obj=new Connectiontlass();
74 String s="select name,password from Librarian where name='"+name+"'
and password='"+pass÷"'";
75 ResultSet rest=obj.stm.executeQuery(s);
76 if(rest.next(l)
77
78 System.00t.println("Librarian Section");
79 new LibrarianSection().setVisible{true);
80 this.setVisible(false);
81 }
82 else
83
84 TOptionPane.showMessagenialog(null,"Wrong");
85 this.setVisiblefal e:;
86 this.setVisible(true);
87
82 else
33
84
JaptiapPene.shomMessageDialoenull,"Wrung");
85 thil .setVisible false);
86 th.1]..setVisitple true);
87
88 }
89 catch(ExceptioP ee)
90
91 ee.printStackTratel
I;
92 }
93
94
95 if(e.getSource()==bt2)
96
97 this.setVisible(false);
98
99
100 public static void main(String[] arg ){
lal new Librarian().setVisible(true);
182
103
104
105
44 men2.setFont f
;
45 men3.setFont f
;
46 men4.setFont f
;
47 men5.setfont f
;
4B menti.setFont f.;
49 ment2.setFont f.;
50 ment23.setFont f
;
51 ment3.setFontif);
52 ment4.setFontif);
Si ment5.setFo W
f);
54
mentl.addActionListener(this);
55
ment2.addActionListener(this);
56
ment23.addActionListener(this);
57
ment3.addActionListener(this);
58
ment4.addActionListener(this);
59
mentS.addActionListener(this);
60 setlMenuBar;m1!;
61 adddl:;
62
63
64 public void actionPerformed(ActionEvent e)
65
66 String comthe.getActionCommand();
67 if(cord.ewals("Add Book"))
68
69 System.out.println("Add");
70 new AddBook().setVisible(true);
71 )
72 else if(cord.equals("Viely Book")}
73
74 Systemout.println("View Info");
75 new ViewInfo().setVisible(true);
76
77 else if(comd.equals("View Issue Book"))
75'
79 System.aut.println("View Issue Borfgrok");
84 new ViewIssueaook().setVisible(true);
80 new
ViewIssueBook().setVisible,(true);
81 )
82 else if(cord.equals("Issue
Book"))
83
84 System.out.println("Issue
Book");
85 new
IssueBook().setVisible(true);
86
87 else ifticomd.equa/s("Return
Book-))
88
89 System.out.println("geturn
Book");
90 new
ReturnBook().setVisible(true);
gl )
92 else if(cord.equals M
ogout
93
94 System.out.print1 W
logout");
95 Systen.exit(0);
96' )
37
98 public static void mainI,StringE argsg
99 new LibrarianSection
seirsasibletrue:;
mola
181 I
102
41
tf4.setFont f1
42
tf5.setFont f1 ;
43
btl.setFont fl %;
44
bt2.setFontf1:;;
45
btl.addilictionListener :his);
46
bt2.addActionListener 71,is);
47
11.setHorizonta1llignmentC]Labe1.CENTER);
4#1
11.setForegroundiColor.WHITE ;
49
pl=new Wanelf);
50
pl.setLayout new GridLayout(1,1,10,10));
51
pl.addA1;;
52
p1.set8ackground(Color.BLUE,;
53 p2=ftew
]Panel);;
54
p2..setLayout.'new .GridLayout(6,2,10,10)",;
55 p2.add
12 ;
56
p2.add tfl ;
57 p2.add
13';
58
p2.add tf2.;
59 p2.add
14 ;
60
p2.add:tf3,;
61 p2.add
15.;
62
p2.add tf4:;
'63 p2.add
16 ;
'64
p2.add(tf5).;
65
p2..add(bt1);
66
p2.adebt.2);,
67
setLayout(new Borderi_ayout(10,10));
68
addi.p1,11orth"};
69
addip2,"Center'J;
70 }
71
public void actionPerformed(ActionEvent
72
73 String Book Nb=tfl.getText, i;
74 String Book Mame=tf2.getText
75 String Author=tf3.getText'.;
76 String Publisher=tf4.getText
77 String Quantity=tf5..getText ;
78 String Date-new java.util-Date .toStringi.,5
79
SU if(e.getSource()--btl)
81
82 tryA
03. ConnectionClass obj-ne6 ConnectionClass();
84 String q--insert into Add Book(Book No,Book
Name,A6thor,Publisher..Quentity.Date) yalues(.-
85 Book
86 int aa-obj_stm_ejtecotellpdate(q);
87 iffaa--1)
88
89 JOptionPane.showNessageDialog(o 11.-Inserted
Succestully-);
40 this.setVisible[false);
41
42 else
49
94 JOptionPane.showNessageDialogio 11.-Sramething Wrong L!I
Insert data Correctly
95 this.setVisible(true);
96
97
94
44 catch(Exception ee)
100
101 er.print5tackTroce{);
102
103
184 11 -(e.get5onrce()=-6t2)
105
106 this_setVisible(false);
107
108
109 1
110
111 public static void
nain(String[] nc85){
112 new
AddBook().setVisible(troe);
114 1
12. Viewlnfo.java
b public class ViewInfu extend=_ ]Frame
String x[] {"Irj'hicilt
Nce,'"6bak_N4me"j'Auturn,"Quantity","Issue beak","batell
Mirttam bt;
String y[][I.new String[a][R];
ie int i=81,j41;
u ]Table ti
Lt Font f,f1;
LS
L4 Viewlirfa()
13
it super("Idow Doak Enfurnation");
setLocatiuni58,760;
11i set5ize1880,4113e);
i2 fmn.ew Font( Arial",Fant.b0L%1S',;
20 try
21
12 GannectianClass
obj=new CannectionC1ass()3
String q='select from Add_bo2L";
111 ResultSst rest
wubj,stmJexecutequery(q);
7J3 while(rest.nert())
lb
18 y[l][j++]=restJgetString(-64mak_NO");
20 y[i][j++:=rest,gatString.rMak_Nare");
y[i][j+4"=rest,getStringi"Authur');
AI y[i][j++]=rest,getString('QUantity");
32 y[i][J++1=rest,get5tring.rissue_6ursk");
53 y[i][1++]=rest,getString(Tate);
34 i++1
is i=0;
57 t=new nable(y,x);
10 tsetFostCf);
39
ae catchlExceptinn exi
41
42 ex-printStackTrate();
45
44 IStrolipana sp=new 3ScrullPane r.i
as add(sp);
46 1
47 public antic void args)1
413 new ViewInfu(),setVisible:7-.=.;
40 )
S8
13.IssueBook.java
7 public class Issualook extends ]Frame implements
ActionListenect
8 ]Label 11,12,13,14,15,16,17,18;
9 ]TextField
tfl,tf2,tf3,tf4,tf5,tf6;
10 Panel pl,p2;
11 1Button bt1,bt2;
12 Choice ch;
13 Font fjf1;
14 IssueBook()
15 (
16. soperC"Issue Book Section");
17 setLocationI400,2007;
18 setSize(650,400);
19 f=new
Font("Arial",Font.BOLD,25);
20 fl=new
Fonti"Arial"ffunt.BOLD,20);
21 11=new JLabel("Issue Book");
22 12 lew JLabel("Baok
23 13 1ew Label("Book No°};
24 14 new JLabel("Book Name");
25 15=oew JLabel("Student Id");
25 16 1ew JLabel("Student Name");
27 17=oew JLabel("Student
Contact");
28 184Few JLabel("Book
Quantity");
29 btl=new Button("Issue Book");
30 bt2=new Button "Cancel");
31 tfl=new ]TextField .;
32 tf2=new ]TextField •;
33 tf3=new ]TextField .;
34 tf4=new ]TextField .;
35 tf5=new ]TextField •;
36 tf6=new ]Text Field
37 11.setFonti.f1;
38 12.setFont(f1 ;
39 13.setFont:f1
40 14.setFont'f1 ;
41 15.setFont.fl
42 16.setFont.fl
43 17.setFontyF1:;
44 18.setFon- •fi
45 tfl.setFont fl
46 tf3.setFont fl
47 tf2.setFont #1.;
48 tf4.setFont #1.;
49 tf5.setFont #1..;
50 tf6.setFont #1.;
51 bti.setFont #1..;
52 bt2.setFont #1..;
53 bti.addActionlistener(this);
54 bt2.addActionListener.this);
55 11.setHorizontalAlignment0Labe1.CENTER%
55 11.setForegroundiColor.WHITO:
57 ch=new Choice;)';
58 try
59 {
60 CoonectionCiass obj=new ConnectionClass();
61 String q="select Id from Add_Book";
62 ResultSet rest=obj.gtm.executeQuery(q);
63 wnile(rest.next())
64
55 ch.add(rest.geUtrine"Id"
66 }
67
68
69 catch(Exceptioo e)
70
71 e.printStackTrace();
72
73 ch.setFonffr;
74 pl=new Partel.
75 pl.setLayout,rew GridLayout(1,1,10,10Y.;
76 pl.add 11.;
77 pl.setBackgroun“olor.BLUE);
78 p2=new Mane.0
79 p2.setLayout new GridLayout(8,2,10,10P;
80 o2.add.L2,;
81 p2..adc*ch);
82 p2.adEK13);
83 p2..add(tf1);
84 p2.add 14:?;
89 p2.add tf2-;
86 p2.add 15 ;
87 p2.add tf3);
88 p2.add 16);
89 p2.add tf4);
90 p2.add 17);
91 p2.addtf5);
92 p2.addj8);
33 p2..ad •.tf6);
94 p2..adeArti);
95 p2..adabt2);
96 settayouVnew
BorderLayout(10,10));
97 add,p1,"North");
9Z add,p2,"Center');
99
lesa ch..addllauseListenernew
MouseAdapter()
101
102 public void
mauseClicked(MouseEvent arg0)
183 46,'
104 try
105
lee anileetionClass obj2=nea
ConnectionClass();
107 int
ithInteger.parseInt(ch.getSelectedltem());
100 String ql="select
* from Add_Book where Id--+id+"'";
109 kesultSet
restl=obj2.stmexecuteQuery(q1);
110 while(restl.next())
111
112
tfl.setTewt(restl.getString?"Eopk_Mo":0;
113
tf2.setText(restl_getString("Bopk_Name));
114 tf6.setText(re
tl.getString("Quantity"));
115
116
117
11H catchfExceptien exx)
12
12.8
exx.printStackTrace[];
321 1
125
3,4 ))3
1.5
124 public void
actioneerfurned(ActionEvent e)
138 if,.e.getinnrcefliwwbt11
131
132 int qnt=0;
133
irrt id=Integer.parseInt(ch.getSelectedItem17);
134 String
8nok_No.tfl.getText();
siring
8 ok gamemtf2.getText();
136
int Stadent_Idminteger.parselnt(tf3.getText());
327
String St4dent_Name=if4.getText();
134
String Stadent_Cent.tf5.getText();
139
String Cate∎nero java.wtil.Date(1.to5tring();
14B try{
143
GennectienClass Dia13..new ConnectionCiassOI
142
String gem-select Quantity
1Frnir. Add Book where
142
ResultSet restgwobjS.ste.executeQuery(qe);
144 while(reste.nextf•
115 {
lintmInteger.parseIntkrestg.getString(-Quantity.));
147
14H If(ents.g)
149 {
150 5013-denPane•si
sainealeingfnull...Monk Quantity is less
1
-1;
151 this-setYlsibleffalsa);
152
113 also
114
string V
.-insert into
Issue_anok(td,gnok_Ne,Rnok_Name,student_rd,Student_kame,Student_Lont,nate) values
C
tse kitont en+. •, • ',gook JfIme
,
...gtodent_Md
,Atudent ••.Student [ont.— ...tatem,.)-;
157
String q3..update Add gunk set issue_ftunk=issue_goak*1 where id.'.1-1d."";
14. ViewlssueBook.java
:LaSE Viewtssueficalk
2- rame
15. returnBook.java
7 public class Returngook
extends iFrame implements ActionListeneri
8 ]Label 11,12,13;
9 Button btl,bt2;
10 Panel pl,p2;
11 NextField tfl,tf2;
12 Font f,f1;
13 ReturnBook()
14
15- super(lieturn Book");
16 setLocation(400„200);
17 set5ize(500,200);
18 f=new
Font("Arial",Font.BOLD,25);
19 fl=new
Font("Aria)",Font.BOILD.„20);
20 11=new JLabel("Return
Book"];
21 12=new Eabel("Book No");
22 13-new Eabel("Student
Id");
23 bt1-new ButtoM."Return
Book");
24 tit2=new
3ButtonyTancel");
25
btl.addActionListener(tnis);
26
bt2.addActionListener(this);
27 tfl=new ilextFieldi.);
28 tf2-new JTextFieldrj;
25 11.setFont!..c1;
30 12.setFont'fl
31 13.setFont,f ;
32 btl.setFont fl
33 bt2.setFont fl
34 tfl.setFont fl ;
35 tf2.setFont fl ;
36
11.setForiiontalAlignmenthabe1.CENTER:1;
37
11.setForeground(Color.WHITE;;
35 pl=new Panel);
39 pl.setLayoWnew
6ridLayout(1„1,10,10));„
40 pl.add(11);
41
p1.setBackground(Color.8LUE);
42 p2-new Faneli);
43 p2.setLayouflnew
5ridLayout(3„2,10,10));
44 p2.add!.12
;
45 p2.add(tf1!;
46 p2.addi,13.;
47 p2..add:Af2,;.
48 p2...add:bt1);
44 p2...add:bt2);
50
setLayoutinew BorderLayout(10,10)•;
51
add01,"North"!;
52
add02,"Center":.;
53
54
55 public void actionPerformed(ActionEyent e)
56
57 String Book_No=tfl.getText();
58 int Stuld=Integer.parselnt(tf2.getText());
59
60 if(e.getSource()==btl)
61
62 try
63
64 ConnertionClass obj=now Connertiontlass();
65 String q="delete from Issue_Book where Book_No=—+Book No,— and Student_Id=—
+StuId, — ;
66. int res,3bj.stm.executeUpdate(q);
67 if(res,==0)
68.
69 7OptionPane.showMessageDialog(null,"Book Not Issue Yet");
70. thismsetVisiblee.false',;
71 1
72 else
73
74 String ql="update Add_Book set Issue_Book=Issue_Book-1 where
Book_No=',1800k_blo+"'";
75 String q2="update Addjook set Quantity=Cuantity.1 where Book_No=—
+Ecok_No,"'";
76 int aaa pbj.stm.executeUpdate(q1);
77 int aaaa=obj.stimmexecutedpdate(q2);
78
79 if(aaa
= 1)
80
Sl if aaaa ==
32 {
S3 lOptionPanemshowNessageDialog(null,"Hook Return Sucessfully");
84 this.setVisible(true);
S5
56 else
S7 111
sa
lOptiorPane.showMessageDialog(null,"5affleThingWrengl");
ag
90
91
92
93
94 catch(Exception ee)
95
96 eemprintStackTrace();
97 }
93 1
99 if(e.get5ource()==bt21
100
101 thismsetVisible(faIse);
102
103 i-FemgetSource()==bt2)
104
105 thi msetVisible(faIse);
106
107 }
168
109 public static void main{String[] arg$){
110 new ReturnBookOmsetVisible(true);
111
112 )
113
114
Book_Name VARCHAR(50),
Student Id VARCHAR(10),
Student Name VARCHAR(50),
Student Cont VARCHAR(50),
Date VARCHAR(50)
);
CREATE TABLE Add Book
(
Id INTEGER PRIMARY KEY NOT NULL AUTO INCREMENT,
Book No VARCHAR(10) ,
Book_Name VARCHAR(50),
Author varchar(20),
Publisher VARCHAR(50),
Quantity VARCHAR(10),
Issue Book INTEGER DEFAULT 0,
Date VARCHAR(50)
INSERT INTO admin values
("admin","pass123");
SELECT * FROM admin;
INSERT INTO Librarian values
("Librarian","pass123");
UNIT TESTING
Unit testing is undertaken when a module has been created and successfully
reviewed .In order to test a single module we need to provide a complete
environment
ie besides the module we would require Unit testing was done on each and every
module that is described under module description of
1. Test For the admin module
Testing admin login - This is used for log in of admin of the system.In this we
enter
the username and password if both are correct Admin section will open other wise if
any of data is wrong it will show an error redirected back to the login page and
again
ask for username and password
Testing add new Librarian :- This is used to add new librarian by providing the
correct details . if all details are correct the librarian add to the system other
it throws
error.
Testing view librarian :- This is used to see all information of librarians. if it
shows
all the data the view librarian is working.
FUTURE SCOPE
In adding the design of an online library management system to increase user
interaction.
— Add icons on the center of the admin and login section through which users can
easily
access the required information.
In adding the more features of the online library management system to develop
access
with user's flexibility.
— To authenticate the users based on the system users list which is maintained by
the
operating system
— To restrict the usage of all files by the users based on their privileges on the
system
— Adding the functionality of forgot password.
— Show the book issue and remaining book data in graphs.
References
Youtube
https://www.youtube.com/
JavaTpoint
https://wwwj avatpoint.com/j ava-tutorial
W3Schools
https://www.w3schools.com/sql/