Professional Documents
Culture Documents
I would like to thank my parents and friends who supported to complete this project
within the allocated time. I would also like to thank Mr. Dasun Sirimewan our lecturer
for giving us support to complete the project successfully. This assignment helped me
to get a good knowledge about Java language and designing a system using Java
language was a good experience for me.
4.4 Identify and implement opportunities for error handling and reporting........68
5.1 Provide suitable test plan to critically review and test the developed system.
73
5.2 Provide suitable test cases to analyze the expected test results against actual
outputs to identify discrepancies..............................................................................75
5.4 Create user documentation for the developed java program solution.........108
6 Appendix A.........................................................................................................131
7 Appendix B.........................................................................................................133
7.1 Questionnaire...............................................................................................133
8 Reference............................................................................................................134
Object
An object in an OOP concept refers to a specific type, or instance, of a class.
Each object has a structure similar to other objects in the class, but can be
assigned individual characteristics. An object can also call functions, or
methods, specific to that object.
Inheritance
In object oriented programming, inheritance is the concept that when
a class of objects is defined, any subclass that is defined can inherit the
definitions of one or more general classes. A class can be defined using another
class as a foundation. In object oriented programming terminology, one class
can inherit fields and methods from another. An object that inherits from
another is called a subclass, and the object it inherits from is called a superclass.
A subclass extends the superclass. This not only speeds up program
development; it also ensures an inherent validity to the defined subclass object.
This concept allows to programmers for creating applications easily because of
this concept programmer don`t want to create many classes.
Encapsulation
In programming, the process of combining elements to create a new entity. For
example, a procedure is a type of encapsulation because it combines a series of
computer instructions. Likewise, a complex data type, such as a record or class, relies
on encapsulation. Object oriented programming languages rely heavily on
encapsulation to create high level objects. Encapsulation is closely related
to abstraction and information hiding. As I said, encapsulation is the process of
wrapping internal data like functions and variables together. Encapsulation allows
many benefits to programmers when coding. Because of encapsulation concept,
programmers can be made read only or write only fields, A class can have total
control over what is stored in its fields and the users of a class do not know how the
class stores its data.
Abstraction
Abstraction is the act of representing essential features without including the
background details or explanations. In the software engineering, the abstraction
principle is used to reduce complexity and allow efficient design and implementation
of complex software systems. Abstraction is one of the most important principles in
object oriented software engineering and is closely related to several other important
concepts, including encapsulation, inheritance and polymorphism. Abstraction is
applied in the process of identifying objects to model the problem. It is the process of
reducing these objects to their essence such that only the necessary elements are
Features of JAVA
Simple
Java syntaxes are based on C++ language and it is easy to use and understand to
users. Java language modified with removing rarely used items like explicit
pointers, operator overloading and etc. And also, it includes the rich set of APIs.
Finally, we don’t waste our time to remove unreferenced object, because, java has
a garbage selection feature.it removes the above mentioned objects automatically.
Platform independent
A platform is the hardware or software environment in which a program runs.
There are two types of platforms software based and hardware-based. Java
provides software based platform. The Java platform differs from most other
platforms in the sense that it is a software based platform that runs on the top of
other hardware based platforms. Java code can be run on multiple platforms e.g.
Windows, Linux, Sun Solaris, Mac/OS etc. Java code is compiled by the compiler
and converted into bytecode. This bytecode is a platform-independent code
because it can be run on multiple platforms. For example, we can introduce
WORA.
Robust
Robust simply means strong. Java uses strong memory management. There is lack
of pointers that avoids security problem. There is automatic garbage collection in
java. There is exception handling and type checking mechanism in java. All these
points make java robust.
Architectural Neutral
Architecture represents processor. A Language or Technology is said to be
Architectural neutral which can run on any available processors in the real world
without considering their development and compilation.
Java Virtual Machine is a single unit but it contains sub parts. Such as,
o Class Loader
o Class Area (Method Area)
o Stack and Heap
Java is both compiler and interpreter language. When you compile a Java program it
creates .class file which is collection of byte code, this byte code is not machine
instruction instead they are instruction which Java virtual machine can understand.
Since every Java program runs on Java virtual machine, same byte code can be run on
any platform. key is byte code is not machine instruction they are platform
independent instruction to JVM.
Java programming language also hardware independent. In early years, and mostly in
the near and far future, there are so many different architectures for CPU. ARM, X86,
MIPS, etc. When compiling C code for different hardware, it means you compile for
all of these CPU. However, with Java, you, as an application developer, compile only
once. The work translating byte code to machine code is left to JVM writers. JVM
providers are responsible to write different Java runtime for different hardware.
Class Diagram
Class_member
All the member related methods I coded in this class. There are 07 public methods
and 06 private variables in this class. User can add, update, search and delete
member details using these methods and variables.
Class_User
All the user related methods I include into this class. User class mainly
responsible for converting members into users. As this system, every standard
member has a unique user name and password for login to the system.
Administrator or super user can create unique user names and passwords for
members using this class. This user class has 10 methods and 5 variables to
perform user related tasks properly.
Class_Book_Release
Book release class controls all the book reserving process of this system. This
class has 16 methods and 08 variables to manage book reserving process. User can
get 02 books as this system and all the users can check books details and released
book details. Librarian can see all of the book released details and member can see
his or her details only.
Class_Book_Return
Book return class has all the methods related to book returning process. Only
librarian can interact with these functions. Because, other users have not
privileges to interact with these functions. Book returning process is the very
important one because, payments are connecting with this process. In this book
return class have methods to count payments, dates and others.
tbl_member entity
This entity helps to store member details of the system, which means, even
librarian details are stored in this entity. This entity has 06 attributes. There is
member_id, member_name, member_address, member_contact, member_nic and
finally email. Among these attributes, member_id is a special one because, that
attribute has primary key constraint and auto increment facility.
tbl_book entity
This entity helps to store book details of the system This entity has 05 attributes.
There is book_id, book_name, category, comment and finally author_name.
Among these attributes, book_id is a special one because, that attribute has
primary key constraint and auto increment facility.
tbl_user entity
This entity helps to store user credentials of the system, which means, even
librarian details or super user credentials are stored in this entity. This entity has
05 attributes. There is user_id, member_name, user_access, password and finally
user_name. Among these attributes, user_id is a special one because, that attribute
has primary key constraint and auto increment facility.
tbl_book_release entity
This entity helps to store released books and released date of the system. This
entity has 06 attributes. There is release_id, member_name, book1, book2,
release_date and finally return_date. Among these attributes, release_id is a
special one because, that attribute has primary key constraint and auto increment
facility.
tbl_payment entity
This entity helps to store payment and fine details of the system. This entity has
06 attributes. There is payment_id, member_name, days, amount, release_date and
finally return_date. Among these attributes, payment_id is a special one because,
that attribute has primary key constraint and auto increment facility.
static Connection c;
static Statement s;
public static void addBooks(String bname, String aname, String category, String comment)
{try {
c = DBConnection.getMyConnection();
s = c.createStatement();
ex.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
while (rs.next()) {
v.add(rs.getString("book_name"));
v.add(rs.getString("author_name"));
v.add(rs.getString("category"));
v.add(rs.getString("comment"));
}} catch (Exception e) {
e.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
System.out.println(count);
if (count == 1) {
LIBRARIAN_MAIN_MENU.ID.setText(rs.getString("book_id"));
}} catch (Exception e) {
e.printStackTrace();}}
public static void updateBooks(int id, String bname, String aname, String category, String
comment) {
try {c = DBConnection.getMyConnection();
s = c.createStatement();
ex.printStackTrace()}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
dtm.setRowCount(0);
while (rs.next()) {
v.add(rs.getString("book_name"));
v.add(rs.getString("author_name"));
v.add(rs.getString("category"));
v.add(rs.getString("comment"));
dtm.addRow(v);
}} catch (Exception e) {
e.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
dtm.setRowCount(0);
while (rs.next()) {
v.add(rs.getString("book_name"));
v.add(rs.getString("author_name"));
v.add(rs.getString("category"));
v.add(rs.getString("comment"));
dtm.addRow(v);
}} catch (Exception e) {
e.printStackTrace();}}
c = DBConnection.getMyConnection();
s = c.createStatement();
ex.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
dtm = (DefaultTableModel)
MEMBER_MAIN_MENU.Table_Member_Books.getModel();
while (rs.next()) {
v.add(rs.getString("book_name"));
v.add(rs.getString("author_name"));
v.add(rs.getString("category"));
v.add(rs.getString("comment"));
dtm.addRow(v);
}} catch (Exception e) {
e.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
dtm = (DefaultTableModel)
MEMBER_MAIN_MENU.Table_Member_Books.getModel();
while (rs.next()) {
v.add(rs.getString("book_name"));
v.add(rs.getString("author_name"));
v.add(rs.getString("category"));
v.add(rs.getString("comment"));
dtm.addRow(v);
}} catch (Exception e) {
e.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
dtm = (DefaultTableModel)
MEMBER_MAIN_MENU.Table_Member_Books.getModel();
dtm.setRowCount(0);
while (rs.next()) {
v.add(rs.getString("book_name"));
v.add(rs.getString("author_name"));
v.add(rs.getString("category"));
v.add(rs.getString("comment"));
dtm.addRow(v);
}} catch (Exception e) {
e.printStackTrace();}}}
static Connection c;
static Statement s;
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
dtm = (DefaultTableModel)
LIBRARIAN_MAIN_MENU.Table_Release_Member.getModel();
while (rs.next()) {
v.add(rs.getString("member_name"));
v.add(rs.getString("member_nic"));
dtm.addRow(v);
}} catch (Exception e) {
e.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
dtm = (DefaultTableModel)
LIBRARIAN_MAIN_MENU.Table_Release_Book1.getModel();
while (rs.next()) {
v.add(rs.getString("author_name"));
dtm.addRow(v);
}} catch (Exception e) {
e.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
dtm = (DefaultTableModel)
LIBRARIAN_MAIN_MENU.Table_Release_Book2.getModel();
while (rs.next()) {
v.add(rs.getString("book_name"));
v.add(rs.getString("author_name"));
dtm.addRow(v);
}} catch (Exception e) {
e.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
dtm = (DefaultTableModel)
LIBRARIAN_MAIN_MENU.Table_Release_Book1.getModel();
dtm.setRowCount(0);
while (rs.next()) {
v.add(rs.getString("author_name"));
dtm.addRow(v);
}} catch (Exception e) {
e.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
dtm = (DefaultTableModel)
LIBRARIAN_MAIN_MENU.Table_Release_Book2.getModel();
dtm.setRowCount(0);
while (rs.next()) {
v.add(rs.getString("book_name"));
v.add(rs.getString("author_name"));
dtm.addRow(v);
}} catch (Exception e) {
e.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
dtm = (DefaultTableModel)
LIBRARIAN_MAIN_MENU.Table_Release_Member.getModel();
dtm.setRowCount(0);
while (rs.next()) {
v.add(rs.getString("member_name"));
v.add(rs.getString("member_nic"));
dtm.addRow(v);
}} catch (Exception e) {
e.printStackTrace();}}
public static void releaseBooks(String book1, String book2, String member, String
start_date,String end_date) {
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
ex.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
dtm = (DefaultTableModel)
LIBRARIAN_MAIN_MENU.Table_Release_Book_Schedule.getModel();
while (rs.next()) {
v.add(rs.getString("book1"));
v.add(rs.getString("book2"));
v.add(rs.getString("member_name"));
v.add(rs.getString("release_date"));
v.add(rs.getString("return_date"));
}} catch (Exception e) {
e.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
ex.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
System.out.println(count);
if (count == 1) {
LIBRARIAN_MAIN_MENU.ID.setText(rs.getString("release_id"));
}} catch (Exception e) {
e.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
dtm = (DefaultTableModel)
LIBRARIAN_MAIN_MENU.Table_Release_Book_Schedule.getModel();
dtm.setRowCount(0);
while (rs.next()) {
v.add(rs.getString("book1"));
v.add(rs.getString("book2"));
v.add(rs.getString("member_name"));
v.add(rs.getString("release_date"));
v.add(rs.getString("return_date"));
dtm.addRow(v);
}} catch (Exception e) {
e.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
dtm = (DefaultTableModel)
MEMBER_MAIN_MENU.Table_Book_Release1.getModel();
while (rs.next()) {
v.add(rs.getString("book_name"));
v.add(rs.getString("author_name"));
dtm.addRow(v);
}} catch (Exception e) {
e.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
dtm = (DefaultTableModel)
MEMBER_MAIN_MENU.Table_Book_Release2.getModel();
while (rs.next()) {
v.add(rs.getString("book_name"));
v.add(rs.getString("author_name"));
dtm.addRow(v);
}} catch (Exception e) {
e.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
dtm = (DefaultTableModel)
MEMBER_MAIN_MENU.Table_Book_Release1.getModel();
dtm.setRowCount(0);
while (rs.next()) {
v.add(rs.getString("book_name"));
v.add(rs.getString("author_name"));
dtm.addRow(v);
}} catch (Exception e) {
e.printStackTrace();}}
try {
s = c.createStatement();
dtm = (DefaultTableModel)
MEMBER_MAIN_MENU.Table_Book_Release2.getModel();
dtm.setRowCount(0);
while (rs.next()) {
v.add(rs.getString("book_name"));
v.add(rs.getString("author_name"));
dtm.addRow(v);
}} catch (Exception e) {
e.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
dtm = (DefaultTableModel)
MEMBER_MAIN_MENU.Table_Release_Details.getModel();
while (rs.next()) {
v.add(rs.getString("book1"));
v.add(rs.getString("book2"));
v.add(rs.getString("member_name"));
v.add(rs.getString("release_date"));
v.add(rs.getString("return_date"));
dtm.addRow(v);
}} catch (Exception e) {
e.printStackTrace();}}}
static Connection c;
static Statement s;
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
dtm = (DefaultTableModel)
LIBRARIAN_MAIN_MENU.Table_Book_Return.getModel();
while (rs.next()) {
v.add(rs.getString("member_name"));
v.add(rs.getString("book1"));
v.add(rs.getString("book2"));
v.add(rs.getString("release_date"));
v.add(rs.getString("return_date"));
dtm.addRow(v);
}} catch (Exception e) {
e.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
dtm = (DefaultTableModel)
LIBRARIAN_MAIN_MENU.Table_Book_Return.getModel();
dtm.setRowCount(0);
while (rs.next()) {
v.add(rs.getString("member_name"));
v.add(rs.getString("book1"));
v.add(rs.getString("book2"));
v.add(rs.getString("release_date"));
v.add(rs.getString("return_date"));
dtm.addRow(v);
}} catch (Exception e) {
e.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
System.out.println(count);
if (count == 1) {
LIBRARIAN_MAIN_MENU.ID.setText(rs.getString("release_id"));
}} catch (Exception e) {
e.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
ex.printStackTrace();}}
try {c = DBConnection.getMyConnection();
s = c.createStatement();
while (rs.next()) {
v.add(rs.getString("book1"));
v.add(rs.getString("book2"));
v.add(rs.getString("member_name"));
v.add(rs.getString("release_date"));
v.add(rs.getString("return_date"));
dtm.addRow(v);
}} catch (Exception e) {
e.printStackTrace();}}}
static Connection c;
static Statement s;
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
while (rs.next()) {
v.add(rs.getString("member_name"));
v.add(rs.getString("release_date"));
v.add(rs.getString("return_date"));
v.add(rs.getString("days"));
v.add(rs.getString("amount"));
dtm.addRow(v);
}} catch (Exception e) {
e.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
while (rs.next()) {
v.add(rs.getString("member_name"));
v.add(rs.getString("release_date"));
v.add(rs.getString("return_date"));
v.add(rs.getString("days"));
v.add(rs.getString("amount"));
dtm.addRow(v);
}} catch (Exception e) {
e.printStackTrace();}}}
static Connection c;
static Statement s;
public static void addMember(String mname, String maddress, String mnic, String
mcontact, String mail) {
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
ex.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
dtm = (DefaultTableModel)
LIBRARIAN_MAIN_MENU.Table_Member.getModel();
while (rs.next()) {
v.add(rs.getString("member_name"));
v.add(rs.getString("member_address"));
v.add(rs.getString("member_nic"));
v.add(rs.getString("member_contact"));
v.add(rs.getString("email"));
}} catch (Exception e) {
e.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
if (count == 1) {
LIBRARIAN_MAIN_MENU.ID.setText(rs.getString("member_id"));
}} catch (Exception e) {
e.printStackTrace();}}
public static void updateMember(int id, String mname, String maddress, String mnic,
String mcontact, String mail) {
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
ex.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
dtm = (DefaultTableModel)
LIBRARIAN_MAIN_MENU.Table_Member.getModel();
dtm.setRowCount(0);
while (rs.next()) {
v.add(rs.getString("member_name"));
v.add(rs.getString("member_address"));
v.add(rs.getString("member_nic"));
v.add(rs.getString("member_contact"));
v.add(rs.getString("email"));
dtm.addRow(v);
}} catch (Exception e) {
e.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
dtm = (DefaultTableModel)
LIBRARIAN_MAIN_MENU.Table_Member.getModel();
dtm.setRowCount(0);
while (rs.next()) {
v.add(rs.getString("member_name"));
v.add(rs.getString("member_address"));
v.add(rs.getString("member_nic"));
v.add(rs.getString("member_contact"));
v.add(rs.getString("email"));
dtm.addRow(v);
}} catch (Exception e) {
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
ex.printStackTrace();}}}
static Connection c;
static Statement s;
// Calculate fines
int day_fine = 5;
int fine;
if("".equals(LIBRARIAN_MAIN_MENU.Txt_Book_Return_Book1.getText()) &&
"".equals(LIBRARIAN_MAIN_MENU.Txt_Book_Return_Book2.getText())){
}else if(!"".equals(LIBRARIAN_MAIN_MENU.Txt_Book_Return_Book1.getText())
&& !"".equals(LIBRARIAN_MAIN_MENU.Txt_Book_Return_Book2.getText())){
PAYMENT.Txt_Payment_Fine_Amount.setText(String.valueOf(fine));
}else if("".equals(LIBRARIAN_MAIN_MENU.Txt_Book_Return_Book2.getText())){
PAYMENT.Txt_Payment_Fine_Amount.setText(String.valueOf(fine));
}else if("".equals(LIBRARIAN_MAIN_MENU.Txt_Book_Return_Book1.getText())){
PAYMENT.Txt_Payment_Fine_Amount.setText(String.valueOf(fine));}}
public static void addPayment(String name, String release_date, String return_date, int
days, int amount){
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
static Connection c;
static Statement s;
String member_name;
String user_name;
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
//System.out.println(count);
if (count == 1) {
access = rs.getString("user_access");
if ("Administrator".equals(access)) {
new SUPER_USER_MENU().setVisible(true);
member_name = rs.getString("user_name");
SUPER_USER_MENU.LBL_User.setText(member_name);
status = "OK";
} else if ("Member".equals(access)) {
new MEMBER_MAIN_MENU().setVisible(true);
status = "OK";
MEMBER_MAIN_MENU.LBL_User.setText(user_name);
member_name = rs.getString("member_name");
MEMBER_MAIN_MENU.Txt_Book_Release_Member.setText(member_name);
MEMBER_MAIN_MENU.ID.setText(member_name);
} else if ("Librarian".equals(access)) {
new LIBRARIAN_MAIN_MENU().setVisible(true);
member_name = rs.getString("user_name");
LIBRARIAN_MAIN_MENU.LBL_User.setText(member_name);
status = "OK";}
} else {
}} catch (Exception e) {
e.printStackTrace();}
return status;}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
dtm = (DefaultTableModel)
LIBRARIAN_MAIN_MENU.Table_User_Member.getModel();
while (rs.next()) {
v.add(rs.getString("member_name"));
v.add(rs.getString("member_nic"));
dtm.addRow(v);
}} catch (Exception e) {
e.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
dtm = (DefaultTableModel)
LIBRARIAN_MAIN_MENU.Table_User_Member.getModel();
dtm.setRowCount(0);
while (rs.next()) {
v.add(rs.getString("member_name"));
v.add(rs.getString("member_nic"));
dtm.addRow(v);
}} catch (Exception e) {
e.printStackTrace();}}
public static void addUsers(String mname, String user, String pass, String access) {
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
ex.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
while (rs.next()) {
v.add(rs.getString("member_name"));
v.add(rs.getString("user_name"));
v.add(rs.getString("user_access"));
dtm.addRow(v);
}} catch (Exception e) {
e.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
System.out.println(count);
if (count == 1) {
LIBRARIAN_MAIN_MENU.ID.setText(rs.getString("user_id"));
}} catch (Exception e) {
e.printStackTrace();}}
public static void updateUser(int id, String mname, String user, String pass, String access)
{
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
ex.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
dtm.setRowCount(0);
while (rs.next()) {
v.add(rs.getString("member_name"));
v.add(rs.getString("user_name"));
v.add(rs.getString("user_access"));
dtm.addRow(v);
}} catch (Exception e) {
e.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
dtm.setRowCount(0);
while (rs.next()) {
v.add(rs.getString("member_name"));
v.add(rs.getString("user_name"));
v.add(rs.getString("user_access"));
dtm.addRow(v);}
e.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
ex.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
while (rs.next()) {
v.add(rs.getString("member_name"));
v.add(rs.getString("user_name"));
v.add(rs.getString("user_access"));
dtm.addRow(v);
}} catch (Exception e) {
e.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
while (rs.next()) {
v.add(rs.getString("member_name"));
v.add(rs.getString("member_nic"));
dtm.addRow(v);
} catch (Exception e) {
e.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
dtm = (DefaultTableModel)
SUPER_USER_MENU.Table_User_Member.getModel();
dtm.setRowCount(0);
while (rs.next()) {
v.add(rs.getString("member_name"));
v.add(rs.getString("member_nic"));
dtm.addRow(v);
}} catch (Exception e) {
e.printStackTrace();}}
try {
s = c.createStatement();
System.out.println(count);
if (count == 1) {
SUPER_USER_MENU.ID.setText(rs.getString("user_id"));
}} catch (Exception e) {
e.printStackTrace();}}
public static void updateMemberUser(int id, String mname, String user, String pass) {
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
ex.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
while (rs.next()) {
v.add(rs.getString("member_name"));
v.add(rs.getString("user_name"));
v.add(rs.getString("user_access"));
}} catch (Exception e) {
e.printStackTrace();}}
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
System.out.println(count);
if (count == 1) {
MEMBER_MAIN_MENU.ID2.setText(rs.getString("user_id"));
}} catch (Exception e) {
e.printStackTrace();}}}
Methods
Method Name Type Description
+loginFunction(user,pass) void Check user name and password.
+loadMemberTable() void Load member details.
+searchMemberName(mname) void Search member according to name.
+addUsers(mname,user,pass, void Add user to the system.
access)
+loadUserTable() void Load user details.
+updateUser(id,mname,user,pass, void Update user details.
access)
+loadUserID(mname) void Load id according to member name.
+searchUserName(mname) void Search user according to member.
+searchUser(user) void Search user according to user name.
+deleteUser(id) void Delete users.
+loadSuperUserTable() void Load user in super user interface.
+loadSuperMemberTable() void Load member details in super user
interface.
+searchSuperMemberName(mna void Member search according to member.
me)
+loadSuperUserID(mname) void Load member id according to member.
+updateMemberUser(id,mname, void Update member details.
user,pass)
+loadMemberUserID(mname) void Load user id according to user name
Table 2 Methods in user class
Attributes
Attribute
Type Description
name
-id Int This variable used to get id from database.
This variable used to store user inputted member
-mname String
name.
-maddress String This variable used to store user inputted address.
-mnic String This variable used to store user inputted nic
-mcontact String This variable used to store user inputted contact no.
This variable used to store user inputted email
-mail String
address.
Table 3 Attributes of the member class
Methods
Methods
Method Name Type Description
3. Book Return
Attributes
Attribute
Type Description
name
-id Int This variable used to get id from database.
-mname String This variable used to store parsed member name.
Table 7 Attributes of the nook return class
4. Book Release
Attributes
Attribute
Type Description
name
-id Int This variable used to get id from database.
-book1 String This variable used to store selected book 1.
-book2 String This variable used to store selected book 2.
-member String This variable used to store selected member.
-start_date String This variable used to store released date.
-end_date String This variable used to store return date.
-mname String This variable used to parse member name.
-bnane String This variable used to parse book name.
Table 9 Attributes of the book release class
Attributes
Attribute
Type Description
name
-name int This variable used to get id from database.
-release_date String This variable used to store selected book 1.
-return_date String This variable used to store selected book 2.
-days int This variable used to store selected member.
-amount int This variable used to store released date.
Table 11 Attributes of the payment class
Methods
6. Fines
Attributes
Attribute
Type Description
name
-mname String This variable used to store parsed member name.
Table 13 Attributes of the fine class
Methods
Encapsulation
Encapsulation is a OOP concept that describes the whole thing have created with
small parts. For example, we can get a java class. Java class is full object but it has
may be many code or not. But if we want to use encapsulation concept, we have to
use java classes definitely. Because of java class, we can divide our code pleasantly
and we categorize them. For example, I used 07 classes and I categorized methods
and variables into them. Now I can explain and new programmer can easily identify
the code in software. Above mentioned tables prove this concept generally.
Aggregation
If a class have an entity reference, it is known as Aggregation. Aggregation represents
HAS-A relationship. In this situation, we can use the components in another class
without staying that class. I used aggregation in my software. I wanted to parse details
to another class, when was running the other class. First of all, I import the class
which want to parse data to the first running class and call that component through
object.
SWITCH (expression) {
CASE constant expression 1:
statements;
break;
CASE constant expression 2:
statements;
break; }
WHILE (condition) {
statements
}
For loop is the last loop in iteration control structure. We can create conditions,
variable declaration and initialization and increment and decrement operations in
parenthesis. In while loop and do-while loop, we can insert condition only. But in for
loop we can insert many. This is the difference between while and for loops.
Following is the structure of for loop.
A run-time error takes place during the execution of a program, and usually
happens because of adverse system parameters or invalid input data.
Try defines a block of statements that may throw an exception. When a specific
type of exception occurs, a catch block catches the exception. If an exception is
not handled by try/catch blocks, the exception escalates through the call stack
until the exception is caught or an error message is printed by the compiler. A
try/catch block also may be nested with one or more try/catch statements. Each
try statement has a matching catch statement to handle the exception. If an
exception's inner try statement does not have a matching catch statement,
subsequent try statement catch handlers are checked. This process continues
until all inner try statements are checked for a matching catch statement. If a
catch statement does not match, the runtime system handles the exception.
Following is the structure of try catch block.
try {
} catch (Exception e) {
}
When we are using try catch block, we can add another part to the block called
finally. ‘finally’ part adds to end of the catch and we can add statement, conditions or
anything like that to this finally block.
try {
} catch(Exception) {
} finally {}
Throwing an exception
In this situation, I have to use ‘throws’ key word. The Java throws keyword is used to
declare an exception. It gives an information to the programmer that there may occur
an exception so it is better for the programmer to provide the exception handling code
so that normal flow can be maintained. Exception Handling is mainly used to handle
the checked exceptions. If there occurs any unchecked exception such as
NullPointerException, it is programmers fault that he is not performing checkup
before the code being used. Following is the code example for throws key word.
Improve Performance
The NetBeans Profiler provides expert assistance for optimizing your application's
speed and memory usage, and makes it easier to build reliable and scalable Java
SE, JavaFX and Java EE applications. NetBeans IDE includes a visual debugger
for Java SE applications, letting you debug user interfaces without looking into
source code.
Purpose System needs to access multiple users. Without above function, user cannot
access to the system. Therefore, above code lines should be tested.
Results Show message including “CHECK YOUR CREDENTIALS...!” text.
Show message including “Logged as Administrator” text.
Show message including “Logged as Member” text.
Show message including “Logged as Librarian” text.
Table 18 Login test case
Librarian functions
2. Book
Purpose We cannot add book details without this query and function. So this query
and function want to test carefully.
Results Show message including “RECORD ENTERED SUCCESSFULLY...!” text.
Table 19 Add book test case
CLASS_BOOKS.deleteBook(Integer.parseInt(ID.getText()));
//Delete selected Book Details
public static void deleteBook(int id) {
try {
c = DBConnection.getMyConnection();
s = c.createStatement();
s.executeUpdate("DELETE FROM tbl_books WHERE book_id='" + id +
"'");} catch (Exception ex) {
ex.printStackTrace();
}}
Purpose These update and delete functions are the important functions related books.
If user want to update or remove book details, these functions help to perform
that.
Results Show message including “RECORD UPDATED SUCCESSFULLY...!” text.
Show message including “RECORD REMOVED SUCCESSFULLY...!” text.
Table 20 Update & remove book test case
Purpose These functions allows to load book details to the table and search loaded
details according to book name and author name. Therefore, these function
should be tested.
Results
Purpose We cannot add member details without this query and function. So this query
and function want to test carefully.
Results Show message including “RECORD ENTERED SUCCESSFULLY...!” text.
Table 22 Add member test case
c = DBConnection.getMyConnection();
s = c.createStatement();
s.executeUpdate("DELETE FROM tbl_member WHERE member_id='"+ id +"'");
Purpose These update and delete functions are the important functions related
member. If user want to update or remove member details, these functions
help to perform that.
Results Show message including “RECORD UPDATED SUCCESSFULLY...!” text.
Show message including “RECORD REMOVED SUCCESSFULLY...!” text.
Table 23 Update & remove member test case
Purpose These functions allows to load member details to the table and search loaded
details according to member name and NIC. Therefore, these function should
be tested.
Results
Purpose These codes are helping to fill the textfiels according to selected row. Without
these codes, librarian cannot perform book releasing process quickly.
Results
Purpose These functions are responsible for dates. First function get the date from
system and other one adds 14 days to current date. These functions helps to
book release and return processes.
Results
Purpose One of these functions help librarian to release books to the members. And
also, other one helps to update in any case. So these functions should be
tested.
Results Show message including “BOOK RELEASED...!” text.
5. Book Return
Purpose These codes are helping to fill the textfiels according to selected row. Without
these codes, librarian cannot perform book returning process quickly. And
also,dateCount() get the date diference between two dates.
Table 28 Book return data selection test case
Purpose One of these functions help librarian to release books to the members. And
also, other one helps to update in any case. So these functions should be
tested.
Results Show message including “YOUR GRACE PERIOD IS EXCEEDED.\nCLICK ON
PAY BUTTON” text.
Show message including “PLEASE SELECT A ROW” text.
Show message including “BOOK RETURNED” text.
Table 29 Validation & remove released books test case
6. Payment
Purpose This function stores the payment details in the database. Librarian wants to
check payment details later. Without this function, librarian cannot do that.
Results Show message including “PAYMENT SUCCESSFULL...!” text.
Show message including “PAYMENT UNSUCCESSFULLY” text.
Table 30 Add payment test case
Purpose This function calculate the fine amount according the book count and day
count. This function directly responsible for generate payments. So, this
should be tested.
Results
Purpose One of these functions help librarian to release books to the members. And
also, other one helps to update in any case. So these functions should be
tested.
Results Show message including “YOUR GRACE PERIOD ISN`T EXCEED.\nCLICK ON
RETURN BOOKS BUTTON” text.
Show message including “PLEASE SELECT A ROW” text.
Show message including “PAYMENT SUCCESSFUL” text.
Table 32 Validation & remove released books test case
Purpose This function creates the accounts for the members. Without this function,
librarian cannot do that.
Results Show message including “RECORD ADDED SUCCESSFULLY...!” text.
Show message including “PASSWORD DID NOT MATCH...!” text.
Table 33 Create account test case
Purpose This sattement helps to load selected row details into textfields. Above
mentioned method helps to search member details according to member
name.
Results
Purpose This function removes the accounts of members. Without this function,
librarian cannot do that. Therefore, this should be tested.
Results Show message including “RECORD DELETED SUCCESSFULLY...!” text.
Table 35 Remove accounts test case
8. Fines
Purpose This function load fine details to the fine table. Without this function,
librarian cannot manage payment details. Therefore, this function should be
tested.
Results
} catch (Exception e) {
e.printStackTrace();
}
}
Purpose This function helps to search loaded fine details according to member nane.
Librarian can search and get details in member wise. Therefore, this function
should be tested.
Results
Member Functions
Purpose These code snippets are helping member to select books for reserving. They
have to enter manually, if these selection codes doesn`t exist. Therefore, this
should be tested.
Results
Purpose These functions are responsible for dates. First function get the date from
system and other one adds 14 days to current date. These functions helps to
book release and return processes.
Results
Purpose This validation prevents the chance to get extra books before books return
process. According to this function, if member reserved books, he or she must
return that books before get the new one. This is the security validation and
this should be tested.
Results Show message including “YOU HAVE TO RETURN BORROWED BOOKS. \
nBEFORE GET ANOTHER” text.
Purpose This function allows members to update own credentials after creating the
user accounts. This function prevents the interference of the member accounts
even librarian.
Results Show message including “RECORD UPDATED SUCCESSFULLY...!” text.
Show message including “PASSWORD DID NOT MATCH...!” text.
Table 42 Update member details (member) test case
12. Overdue
Purpose Member wants to see the overdue details of the borrowed books. If member
select the row, all details will be show in a particular text fields. If this
selection codes doesn`t work properly, member have to count days and
amount manually.
Results
Purpose This function gets the current date and book released date. After that counts,
the date count. Without this function, we cannot count the day count.
Therefore, this function is very important.
Results
Purpose This function counts the fine amount according to day count. Without this
function, we cannot count the fine amount. Therefore, this function is very
important.
Results
Purpose This addUsers() function creates the accounts for the members. Without this
function, librarian cannot do that.
This deleteusers() function removes the accounts of members. Without this
function, librarian cannot do that. Therefore, this should be tested.
Results Show message including “RECORD ADDED SUCCESSFULLY...!” text.
Show message including “PASSWORD DID NOT MATCH...!” text.
Show message including “RECORD DELETED SUCCESSFULLY...!” text.
Table 46 Create & remove user accounts (super user) test case
Without testing the newly created software solution, we cannot assure that
software. It can be included many bugs or irrelevant thing to client and as a
programmer, we should handle all of them. That’s how a qualified and error
free software solution created. In testing phase, programmer wants to get details
from clients because clients should have to give accurate details to the
programmers. But sometimes, this process can be little bit hard due to many
reasons like time management issues, busyness of the clients or responsible
persons and others. But this phase is the most important and very essential one.
Hence, I created the questionnaire for gather information about this software.
Because of using this method, I can gather information effectively.
When we using questionnaire, tester can identify that what should be tested and
software`s functionality. Therefore, tester can evaluate the software easily. After
the testing process, tester can fill the questionnaire and handover it to the
programmer. Then programmer check again the software and he can fix the
identified bugs. This is the usual process of testing. If we use questionnaire, we
can compare the properties of software with those of hardware and difference in
their development, management and control processes understand different
activities and focuses of software development process and its work product at
different steps.
Currently, user cannot get backups through this system because I didn`t provide that
facility. But, they need this function because, these details are the most important
thing in the whole system and it should be accurate. Sometimes, system data can be
corrupted due to wrong operation or external factor. At that time, they can save their
stored details if they can get a backup from system.
READ WITH US
Library Management
System
(LMS)
User Manual
1 Introduction
Hardware requirements
Dual Core (1.5Ghz minimum) Processor
1 GB Main Memory (2 GB Recommended)
64 MB Video Memory
80 GB HDD
DVD Rom/Writer
UPS
Software requirements
Windows 7 or Higher
JRE 1.8 or higher
WAMP server
Proper anti-virus(optional)
Double click on executable file and click next and select the destination folder to
install JDK.
Click next to proceed and it will take couple of minutes to install.
When this window appears, your JRE installation is complete. Just click close
button.
You can change the default server name through this window. (you can use
default)
And also, you can add your email. (you can use default)
After that, click next.
You can get an idea about books and members, when log on to this.
User have 09 selections in this window.
You can add, update, search and remove book details through this window.
When you are searching the record, you can search by book name or author name.
4. Member
You can add, update, search and remove member details through this window.
When you are searching the record, you can search by member name or NIC no.
Day count and amount count are fully automated functions. (system will show
those without interference)
If you click pay button, the particular record will have disappeared. (book
returned.)
If you click on cancel button, dispose this payment window.
10. Help
You can get information about all the librarian functions, through this window.
11. Member Main Menu
Member can search book details according to book name or author name.
13. Book Release (member)
You can get information about all the super user functions, through this window.
purpose
This technical document describes all the features and requirements of the
newly created library management software. I have created this for
programmers in our side. Therefore, this should be very accurate. And also,
programmers can get a complete idea and this guide to build the software
solution for Read with Us library. Users also use this document to get and
exact idea about system and how to interact with function in the system.
Introduction
Read with Us library is the good library situated in Colombo area. This is
the very famous and good library. But this library is using the paper base
system to keep records like book details and member details. This paper
base manual system has many limitations and problems. So, Read with Us
library management decided to switch this manual system into automated
computer based system. They hope to solve problems with this automated
system. With this newly created system, they can do their day to day
activities like add members and create user accounts, book releasing, book
returning and payments easily.
Functional requirements
The Functional Requirements shows the operations and activities that a system
must be able to perform. This is designed to be read by a general audience.
Readers should understand the system, but no particular technical knowledge
should be required to understand the document. I mentioned the functions
available for administrator, librarian and member in here.
Non-Functional Requirements
Basically, Non-functional requirements describe how the system works,
while functional requirements describe what the system should do.
Usability
Users can work with software easily.
User don’t want to add same details over and over again.
User can select stored details and just one click.
All the functions are quick and simple.
User can perform many functions in one interface.
Portability
This is windows based system. But I have used java programming language to
build this system. Java is a platform independent language. After creating a jar
file, you can run that jar file in any platform, but it needs JRE to run. So, you have
to install JRE before run it.
Operability
Users – Librarian, Members and Super user.
Required Software – Java Runtime Environment (JRE), WAMP server.
Performance
System functions and database response quickly.
This system available in anytime.
Because of using special techniques greatly decreases the dump file count and
because of that system will be fast starting and functioning.
Hardware requirements
Dual Core (1.5Ghz minimum) Processor
1 GB Main Memory (2 GB Recommended)
64 MB Video Memory
80 GB HDD
Software requirements
Windows 7 or Higher
5 Appendix A
5.1 Gantt chart
Figure 51 - Questionnaire