0% found this document useful (0 votes)
15 views16 pages

OOPS PBL

The document describes a project to develop a Faculty Book Management System using Java. It includes an abstract describing the objectives and key components of the project such as a graphical user interface using Swing components, database interaction using JDBC, and functionality for issuing books and viewing issued books. It also includes sections on the existing manual system, the proposed digital system, prerequisite Java knowledge including GUI components, containers, JFrame, and layout managers.

Uploaded by

abhiramg9603
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views16 pages

OOPS PBL

The document describes a project to develop a Faculty Book Management System using Java. It includes an abstract describing the objectives and key components of the project such as a graphical user interface using Swing components, database interaction using JDBC, and functionality for issuing books and viewing issued books. It also includes sections on the existing manual system, the proposed digital system, prerequisite Java knowledge including GUI components, containers, JFrame, and layout managers.

Uploaded by

abhiramg9603
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Faculty book management system

Project Based Learning (PBL) Report


for the course
Object Oriented Programming Lab(20CS21L02)

BACHELOR OF TECHNOLOGY

IN

COMPUTER SCIENCE AND ENGINEERING

By
S.Sai kishore – 22R11A0587
S.Moulali – 22R11A0585
V.Sai Anirudh– 22R11A0592

Under the guidance of


Dr A Sree Lakshmi

Department of Computer Science and Engineering


Accredited by NBA

Geethanjali College of Engineering and Technology


(UGC Autonomous)
(Affiliated to J.N.T.U.H, Approved by AICTE, New Delhi)
Cheeryal (V), Keesara (M), Medchal.Dist.-501 301.

December -2023
TABLE OF CONTENTS

S. No. Contents Page No

1 Abstract 1
2 Introduction 2

3 System Design 3

4 Existing and Proposed system 3

5 Prerequisite knowledge 4–7

7 Implementation 8 - 12

8 Conclusion 13

9 References 14
ABSTRACT

The provided Java project, named FacultyBookManager, is a Swing-based graphical user interface (GUI)
application designed for managing the issuance of books to faculty members. The application interacts with
a MySQL database to store and retrieve information about issued books. The abstract of the project
encompasses the following aspects:

Objective: The primary goal of the FacultyBookManager project is to provide a user-friendly interface for
faculty members to issue books and view information related to issue books. The application facilitates
interaction with a backend MySQL database to store and retrieve data regarding book issuances.

Key Components:

1. Graphical User Interface (GUI):


 Utilizes Swing components such as JFrame, JLabel, JTextField, and JButton to create an intuitive
and user-friendly interface.
 Allows users to input essential details, including Book ID, Faculty ID, Issue Date, Department Name,
Book Name, and Faculty Name.
2. Database Interaction:
 Establishes a JDBC connection to a MySQL database.
 Implements SQL queries for inserting information about issued books and retrieving the list of issued
books.
3. Functionality:
 The application supports the issuance of books through the "Issue Book" button, triggering the
issueBook () method, which inserts the entered data into the database.
 The "View Issued Books" button invokes the viewIssuedBooks () method, displaying a list of issued
books retrieved from the database.
4. User Input Handling:
 Prompts the user for additional details (Department Name, Book Name, Faculty Name) during the
book issuance process.
 Implements error handling and provides feedback to the user through JOptionPane dialogs.

1
INTRODUCTION

The Faculty Book Manager, an innovative Java-based application designed to enhance the efficiency and
organization of book issuance for faculty members in educational institutions. This project combines a user-
friendly graphical interface with seamless MySQL database integration, offering a comprehensive solution
for managing and tracking the issuance of books.

1. Intuitive User Interface: The application features an intuitive and visually appealing GUI created with Java
Swing. Users, including faculty members and administrators, can easily navigate through the interface,
making the book issuance and viewing processes straightforward and accessible.
2. Database Integration: Leveraging JDBC, the Faculty Book Manager seamlessly connects to a MySQL
database. This integration ensures the secure storage of book issuance data, providing a reliable and scalable
solution for educational institutions of varying sizes.
3. Efficient Book Issuance: Faculty members can issue books by providing essential details such as Book ID,
Faculty ID, Issue Date, Department Name, Book Name, and Faculty Name. The application guides users
through the issuance process and provides instant feedback on the success or failure of the transaction.
4. Comprehensive Book Viewing: The application offers a dedicated feature for administrators to view all
issued books. This comprehensive list includes Book ID, Faculty ID, Issue Date, Department Name, Book
Name, and Faculty Name, promoting transparency and accountability in book management.
5. Error Handling and User Feedback: Robust error-handling mechanisms are implemented to ensure a smooth
user experience. Users receive informative messages through JOptionPane dialogs in the event of issues or
successful operations, facilitating effective communication between the application and its users.

For optimal use of the Faculty Book Manager, users are advised to replace the placeholder database
connection details in the code with their actual MySQL database credentials. This customization ensures a
secure and personalized interaction with the database, aligning the application with the specific requirements
of each educational institution.

Whether you are a faculty member seeking to issue books or an administrator overseeing the book
management process, the Faculty Book Manager is designed to simplify workflows, enhance efficiency, and
contribute to the overall organization of educational resources.

2
Software Management

S. No. Description
1. Eclipse/VS Code/Any java Compiler

Hardware Management

S. No. Description
1. Windows 7/8/10/11

Existing System

The existing book issuance system relies on manual, paper-based processes within the educational
institution. Faculty members submit requests using physical forms, and administrators manage records
through traditional filing systems or spreadsheets. This manual approach introduces the risk of errors, limits
accessibility, and may result in inefficient tracking and a lack of transparency in monitoring educational
resource usage.

Proposed System

The proposed Faculty Book Manager offers a digital solution to overcome the limitations of the existing
manual system. With an intuitive GUI and MySQL database integration, faculty members can digitally
submit detailed book issuance requests. The system enables efficient tracking, centralized record-keeping,
and real-time updates on book issuances. Its user-friendly interface, error-handling mechanisms, and
accessibility enhancements aim to streamline the overall management of book issuances, addressing the
challenges of the existing manual system.

3
Java GUI
Java GUI (Graphical User Interface) refers to the graphical elements that allow users to interact with Java
applications. It enables the creation of visual components like windows, buttons, text fields, and more,
making the user experience more interactive and visually appealing.

Java Swing and AWT (Abstract Window Toolkit) are two libraries in Java used for building graphical user
interfaces (GUIs). Both of them provide classes and components to create windows, buttons, text fields, and
other GUI elements.

Hierarchy of Java GUI libraries

4
To use AWT we use java.awt package.
To use swing we use javax.swing package.

Component: (java.awt)

 Component is an abstract class that encapsulates all of the attributes of a visual component.

 It is a super class of all user interface classes.

 A component is something that can be displayed on a two-dimensional screen and with which the user can
interact.

 Attributes of a component include a size, a location, foreground and background colors, whether or not
visible etc.,

Methods defined in class Component are:

 setLocation(int, int),
 getLocation() ---To set and get component location
 setSize(int, int) ---To set component size
 setVisible() ---To show or hide the component
 setForeground(Color), getForeground() ---To set and get foreground colors
 setBackground(Color), getBackground() ---To set and get background colors

Container: (java.awt)

 Container class is a subclass of Component class.

 This is a type of component that can nest other components within it.

Ex:- Window, Frame, and panel are examples of containers.

 A Container is responsible for laying out (that is, positioning) any components that it contains.

JFrame

 JFrame is a window that is not contained inside another window- a Top level container.

 JFrame is the basis to contain other user interface components in Java graphical applications.

 The JFrame class can be used to create windows.

5
JFrame’s constructors:

 JFrame( )
 JFrame(String title)
 After a Jframe window has been created, it will not be visible until you call setVisible( true).

Ex:

Layout Managers

 Arranges and lays out the GUI components on a container.

 Types: Flow Layout Border Layout Grid Layout Card Layout


Gridbag Layout

 Every container has a default Layout Manager:

  JPanel FlowLayout
  JFrame BorderLayout
  JWindow BorderLayout

To set layout manager:

myContainer.setLayout( new LayoutManger() );

6
Steps in Java GUI Programming

1. Import necessary packages.


2. Create top-level container.
3. Set container properties.
4. Create GUI components.
5. Add components.
6. Define Data handling.
7. Display Container.

Java Database Connection

In Java, interacting with a MySQL database is accomplished using the JDBC (Java Database Connectivity)
API. To begin, you must download and include the MySQL Connector/J driver in your project's class path.
This driver facilitates the connection between Java applications and MySQL databases. Once the driver is set
up, establishing a connection to the database is a crucial step. This is achieved by specifying the database
URL, username, and password within the DriverManager.getConnection() method. A utility class, like the
DatabaseConnection example provided, can be used to handle this connection.

Executing SQL queries is a fundamental aspect of database interaction. The Statement or


PreparedStatement classes are utilized for this purpose. For instance, to execute a SELECT query, you
would create a PreparedStatement with the SQL statement and then execute it to retrieve the results. The
obtained results can be processed using a ResultSet. Alternatively, for update queries such as INSERT,
UPDATE, or DELETE, the executeUpdate() method is employed. It allows for the modification of the
database and returns the number of affected rows.

In the provided Java code snippets, placeholders like "your database", "your username", "your
password", "your table", and "column name" should be replaced with the actual details of your MySQL
database, username, password, table name, and column names, respectively. It is essential to handle
exceptions appropriately, particularly in a production environment, to ensure robust error management and
improve the overall reliability of the application.

7
IMPLEMENTATION

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.*;

public class FacultyBookManager extends JFrame {


private JTextField bookIdField, facultyIdField, issueDateField;
private JButton issueButton, viewButton;

public FacultyBookManager() {
super("Faculty Book Manager");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(new GridLayout(7, 2));
add(new JLabel("Book ID:"));
bookIdField = new JTextField();
add(bookIdField);

add(new JLabel("Faculty ID:"));


facultyIdField = new JTextField();
add(facultyIdField);

add(new JLabel("Issue Date:"));


issueDateField = new JTextField();
add(issueDateField);

// Added new fields


add(new JLabel("Department Name:"));
JTextField departmentNameField = new JTextField();
add(departmentNameField);

add(new JLabel("Book Name:"));


JTextField bookNameField = new JTextField();
add(bookNameField);

add(new JLabel("Faculty Name:"));


8
JTextField facultyNameField = new JTextField();
add(facultyNameField);

issueButton = new JButton("Issue Book");


issueButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
issueBook(departmentNameField.getText(), bookNameField.getText(), facultyNameField.getText());
}
});
add(issueButton);

viewButton = new JButton("View Issued Books");


viewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
viewIssuedBooks();
}
});
add(viewButton);

pack();
setLocationRelativeTo(null);
}

private void issueBook(String departmentName, String bookName, String facultyName) {


String bookId = bookIdField.getText();
String facultyId = facultyIdField.getText();
String issueDate = issueDateField.getText();

try {
// Replace these details with your own database connection details
String url = "jdbc:mysql://localhost:3306/library";
String user = "root";
String password = "password";

Connection connection = DriverManager.getConnection(url, user, password);

String query = "INSERT INTO issued_books (book_id, faculty_id, issue_date, department_name,


book_name, faculty_name) VALUES (?, ?, ?, ?, ?, ?)";
try (PreparedStatement preparedStatement = connection.prepareStatement(query)) {
preparedStatement.setString(1, bookId);
preparedStatement.setString(2, facultyId);
preparedStatement.setString(3, issueDate);
preparedStatement.setString(4, departmentName);
preparedStatement.setString(5, bookName);
preparedStatement.setString(6, facultyName);

9
int rowsAffected = preparedStatement.executeUpdate();
if (rowsAffected > 0) {
JOptionPane.showMessageDialog(this, "Book issued successfully!");
} else {
JOptionPane.showMessageDialog(this, "Failed to issue book.");
}
}
} catch (SQLException ex) {
ex.printStackTrace();
JOptionPane.showMessageDialog(this, "Error: " + ex.getMessage());
}
}

private void viewIssuedBooks() {


try {
// Replace these details with your own database connection details
String url = "jdbc:mysql://localhost:3306/library";
String user ="root";
String password = "password";

Connection connection = DriverManager.getConnection(url, user, password);

String query = "SELECT * FROM issued_books";


try (PreparedStatement preparedStatement = connection.prepareStatement(query);
ResultSet resultSet = preparedStatement.executeQuery()) {

StringBuilder result = new StringBuilder("Issued Books:\n\n");

while (resultSet.next()) {
String bookId = resultSet.getString("book_id");
String facultyId = resultSet.getString("faculty_id");
String issueDate = resultSet.getString("issue_date");
String departmentName = resultSet.getString("department_name");
String bookName = resultSet.getString("book_name");
String facultyName = resultSet.getString("faculty_name");

result.append("Book ID: ").append(bookId).append("\n");


result.append("Faculty ID: ").append(facultyId).append("\n");
result.append("Issue Date: ").append(issueDate).append("\n");
result.append("Department Name: ").append(departmentName).append("\n");
result.append("Book Name: ").append(bookName).append("\n");
result.append("Faculty Name: ").append(facultyName).append("\n\n");
}

10
if (result.length() == 14) { // Length of "Issued Books:\n\n"
result.append("No books issued yet.");
}

JOptionPane.showMessageDialog(this, result.toString());
}
} catch (SQLException ex) {
ex.printStackTrace();
JOptionPane.showMessageDialog(this, "Error: " + ex.getMessage());
}
}

public static void main(String[] args) {


SwingUtilities.invokeLater(new Runnable() {
public void run() {
new FacultyBookManager().setVisible(true);
}
});
}
}

11
OUTPUT

12
CONCLUSION

In conclusion, the Faculty Book Manager project offers a robust and efficient solution for streamlining the
book issuance process within educational institutions. The transition from a manual, paper-based system to a
digital platform introduces several benefits, significantly improving the overall management of educational
resources.

By leveraging Java's JDBC API and integrating seamlessly with a MySQL database, the Faculty Book
Manager enhances data accuracy and accessibility. The user-friendly graphical interface simplifies the book
issuance process for faculty members and administrators alike, promoting ease of use and reducing the
likelihood of errors associated with manual data entry.

The centralized record-keeping system ensures that all information related to book issuances is securely
stored and easily retrievable. Real-time updates on book issuances, coupled with efficient tracking and
monitoring features, provide administrators with valuable insights into the utilization of educational
resources.

The project's focus on error handling mechanisms enhances the reliability of the system, ensuring that users
receive informative feedback in case of issues during the book issuance process. This not only contributes to
a smooth user experience but also aids in maintaining the integrity of the database.

In summary, the Faculty Book Manager project represents a significant advancement in the management of
book issuances within educational institutions. Its digital approach not only modernizes existing processes
but also introduces efficiencies that contribute to a more transparent, accessible, and well-organized
educational resource management system. The successful integration of Java and MySQL technologies
demonstrates the project's commitment to providing a scalable and adaptable solution for diverse academic
environments.

13
REFERENCES

1. www.geeksforgeeks.org
2. www.w3schools.com
3. wikipedia.com
4. github.com

14

You might also like