Ajp 2
Ajp 2
Ajp 2
Title of Project
Library Management System
CERTIFICATE
This is to certify that Mr. Raundal Yash Suresh
Roll no 08 Of Fifth Semester of Diploma in
Computer Engineering has successfully completed
the for the Academic yeear 2024 -2025 as prescribed
MSBTE Micro Project in Library Management
System curriculum under the guidance of subject
teacher.
2 Project Requirements 17
3 System Design 19
4 Implementation 20
5 Source Code
6 Functionality 21
7 Output
8 Conclusion
9 Reference
ANNEXURE I
Rubric for Evaluation of Micro Project
CO coverage:
Group Members:
Sr no Roll no Name Of Candidates
Internet Source
References:
https://www.geeksforgeeks.org/network-protocols-and-proxies-in-system-design/
Micro Project Log Book
System Design
✓ Include a high-level architectural diagram showing how the
classes interact.
✓ Provide a class diagram detailing the relationships between Book,
User, and LibraryManagementSystemGUI.
Implementation
✓ Describe how to set up the development environment (JDK
installation, IDE setup).
✓ Explain the code in each class, detailing methods and their
purposes.
✓ Discuss the GUI design, including layout decisions and
component choices.
Source code
# Book.java
public class Book {
private String title;
private String author;
private boolean isIssued; public Book(String title, String author) {
this.title = title;
this.author = author;
this.isIssued = false;
} public String getTitle() {
return title;
} public String getAuthor() {
return author;
} public boolean isIssued() {
return isIssued;
} public void setIssued(boolean issued) {
isIssued = issued;
}
@Override
public String toString() {
return "Title: " + title + ", Author: " + author + ", Issued: " +
(isIssued ? "Yes" : "No");
}
}
# User.java
import java.util.ArrayList;
public class User {
private String name;
private ArrayList<Book> issuedBooks;
@Override
public String toString() {
return "User: " + name + ", Issued Books: " + issuedBooks.size();
}
}
# LibraryManagementSystemGUI.java
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.ArrayList;
public LibraryManagementSystemGUI() {
books = new ArrayList<>();
users = new ArrayList<>();
gbc.gridx = 1;
bookTitleField = new JTextField(15);
bookTitleField.setFont(font); // Set font size to 24
panel.add(bookTitleField, gbc);
gbc.gridx = 0;
gbc.gridy = 1;
JLabel bookAuthorLabel = new JLabel("Book Author:");
bookAuthorLabel.setFont(font); // Set font size to 24
panel.add(bookAuthorLabel, gbc);
gbc.gridx = 1;
bookAuthorField = new JTextField(15);
bookAuthorField.setFont(font); // Set font size to 24
panel.add(bookAuthorField, gbc);
gbc.gridx = 0;
gbc.gridy = 2;
JLabel userLabel = new JLabel("User Name:");
userLabel.setFont(font); // Set font size to 24
panel.add(userLabel, gbc);
gbc.gridx = 1;
userField = new JTextField(15);
userField.setFont(font); // Set font size to 24
panel.add(userField, gbc);
gbc.gridy = 4;
panel.add(buttonPanel, gbc);
viewBooksButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
viewBooks();
}
});
issueBookButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
issueBook();
}
});
returnBookButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
returnBook();
}
});
searchBookButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
searchBook();
}
});
if (title.isEmpty() || author.isEmpty()) {
JOptionPane.showMessageDialog(this, "Error: Both title and
author are required!", "Input Error",
JOptionPane.ERROR_MESSAGE);
return;
}
if (title.isEmpty() || userName.isEmpty()) {
JOptionPane.showMessageDialog(this, "Error: Both book title
and user name are required!", "Input Error",
JOptionPane.ERROR_MESSAGE);
return;
}
// Return a book
private void returnBook() {
String title = bookTitleField.getText().trim();
String userName = userField.getText().trim();
if (title.isEmpty() || userName.isEmpty()) {
JOptionPane.showMessageDialog(this, "Error: Both book title
and user name are required!", "Input Error",
JOptionPane.ERROR_MESSAGE);
return;
}
if (userName.isEmpty()) {
JOptionPane.showMessageDialog(this, "Error: User name is
required!", "Input Error", JOptionPane.ERROR_MESSAGE);
return;
}
users.add(new User(userName));
JOptionPane.showMessageDialog(this, "User added: " +
userName, "User Added",
JOptionPane.INFORMATION_MESSAGE);
}
// Find a book by title
private Book findBookByTitle(String title) {
for (Book book : books) {
if (book.getTitle().equalsIgnoreCase(title)) {
return book;
}
}
return null;
}
// Find a user by name
private User findUser(String userName) {
for (User user : users) {
if (user.getName().equalsIgnoreCase(userName)) {
return user;
}
}
return null;
}