0% found this document useful (0 votes)
0 views10 pages

java report

The document outlines a microproject report on a Library Book Issues Management System developed in Java by Isha H. Gohel. It describes the system's functionalities, including book management, borrowing, and returning processes, along with custom exception handling. The conclusion emphasizes the system's potential to enhance library operations and user experience.

Uploaded by

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

java report

The document outlines a microproject report on a Library Book Issues Management System developed in Java by Isha H. Gohel. It describes the system's functionalities, including book management, borrowing, and returning processes, along with custom exception handling. The conclusion emphasizes the system's potential to enhance library operations and user experience.

Uploaded by

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

A Microproject Report

On
LIBRARY BOOK ISSUES MANAGEMENT SYSTEM

Prepared By:
ISHA H. GOHEL – (236200316063)

Guided By
Shraddha Parmar
Information Technology Department
Government Polytechnic Rajkot
Information Technology Department Object
Oriented Programming with JAVA
(4341602) Semester 4th

GOVERNMENT POLYTECHNIC - RAJKOT


INFORMATION TECHNOLOGY DEPARTMENT

Certificate
This is to certify that below students of fourth semester of diploma
in Information Technology of the Institute Government Polytechnic
Rajkot has successfully completed the micro- project in Object
Oriented Programming with Java (4341602) for the academic year
2024-25.
Sr no. Enroll No. Name Div
1 236200316063 Isha Gohel IT-A

Place: GP Rajkot. (Subject Faculty)


Date: Lect. Shraddha Parmar
INTRODUCTION:

In today's digital age, libraries continue to Play a crucial role in providing


access to Knowledge and resources. To efficiently Manage the borrowing and
returning of Books, libraries often utilize book issue Management systems.
These systems help librarians keep track of available books, manage loan
periods, And ensure smooth transactions for Library patrons.

The Library Book Issues Management System is a Java program designed to


Streamline the operations of a library. It allows librarians to add books to the
Library's inventory, display available Books, issue books to patrons, and
Process book returns. With a user-friendly Interface, this system empowers
Librarians to efficiently manage the Library's resources while providing a
Seamless borrowing experience for users.

Creating a Library Management System in Java involves modeling real-world


library concepts like books, members, borrowing, and returning books. Below is
a code outline for a basic Library Management System demonstrating some
fundamental features.
CODE :
import java.util.ArrayList;
import java.util.List;

// Custom Exceptions
class BookNotFoundException extends Exception
{ public BookNotFoundException(String message) {
super(message);
}
}

class BookUnavailableException extends Exception


{ public BookUnavailableException(String message) {
super(message);
}
}

// Book class
class Book {
int bookId;
String title;
boolean available;

public Book(int bookId, String title)


{ this.bookId = bookId;
this.title = title;
this.available = true;
}
}

// Member class
class Member {
int memberId;
String name;

public Member(int memberId, String name)


{ this.memberId = memberId;
this.name = name;
}
}

// Library class
class Library
{ List<Book> books;
List<Member> members;

public Library() {
this.books = new ArrayList<>();
this.members = new ArrayList<>();
}

public void addBook(Book book) {


books.add(book);
}

public void addMember(Member member) {


members.add(member);
}

public void displayAvailableBooks() {


System.out.println("Available Books:");
for (Book book : books) {
if (book.available) {
System.out.println("Book ID: " + book.bookId + ", Title: " + book.title);
}
}
}

public void borrowBook(int bookId, int memberId) throws BookNotFoundException,


BookUnavailableException {
for (Book book : books) {
if (book.bookId == bookId)
{ if (book.available) {
book.available = false;
System.out.println("Book with ID " + bookId + " borrowed by Member " +
memberId);
return;
} else {
throw new BookUnavailableException("Book with ID " + bookId + " is currently
unavailable.");
}
}
}
throw new BookNotFoundException("Book with ID " + bookId + " not found.");
}
public void returnBook(int bookId) throws BookNotFoundException
{ for (Book book : books) {
if (book.bookId == bookId)
{ if (!book.available) {
book.available = true;
System.out.println("Book with ID " + bookId + " returned successfully.");
return;
} else {
System.out.println("Book with ID " + bookId + " was already returned.");
return;
}
}
}
throw new BookNotFoundException("Book with ID " + bookId + " not found.");
}
}

// Main class
public class LibraryManagementSystem
{ public static void main(String[] args) {
Library library = new Library();

Book book1 = new Book(1, "Java Programming");


Book book2 = new Book(2, "Data Structures and Algorithms");

Member member1 = new Member(101, "Alice");


Member member2 = new Member(102, "Bob");

library.addBook(book1);
library.addBook(book2);

library.addMember(member1);
library.addMember(member2);

library.displayAvailableBooks();

try {
library.borrowBook(1, 101);
library.borrowBook(2, 102);
} catch (BookNotFoundException | BookUnavailableException e)
{ System.out.println("Error: " + e.getMessage());
}
library.displayAvailableBooks();

try {
library.returnBook(1);
} catch (BookNotFoundException e)
{ System.out.println("Error: " + e.getMessage());
}

library.displayAvailableBooks();
}
}
OUTPUT:

Available Books:
Book ID: 1, Title: Java Programming
Book ID: 2, Title: Data Structures and Algorithms
Book with ID 1 borrowed by Member101
Book with ID 2 borrowed by Member102
Available Books:
Book with ID 1 returned successfully.
Available Books:
Book ID: 1, Title: Java Programming

=== Code Execution Successful ===


EXPLAINAION

Book Class: la book with attributes like bookld, title, and available status.

Member Class: Represents a library member with attributes memberld and


name.

Library Class: Manages books, members, borrowing, and returning


functionality in the library.

Main Method: Creates books, members, adds them to the


library, displays available books, borrows a book, returns a book, and displays
available books after transactions.

CUSTOM EXCEPTIONS:
BookNotFoundException & BookUnavailableException
These are custom exception classes that extend Java’s Exception class.

Exception Handling in Java is used to handle runtime errors (exceptions) so the


program doesn't crash abruptly. It uses:

 try: Code that might throw an exception.


 catch: Code that runs if an exception is thrown.
 throw: Manually throw an exception.
 throws: Declares that a method can throw exceptions.

Exception Handling Logic:


 If the book exists and is available → mark as borrowed.
 If book exists but is already borrowed → throw
BookUnavailableException.
 If book ID is not found → throw BookNotFoundException.

This code provides a fundamental structure for a Library Management System


in Java. You can expand on this by adding more features like managing due
dates, fines, searching for books, and extending functionality as per the
requirements of the system.
Conclusion

In conclusion, the library book issues management system developed in Java


offers a robust solution for efficiently managing the borrowing and returning of
books. It provides features such as user authentication, book search and
availability checking. borrowing and returning functionality, as well as
administrative capabilities for managing books and users. By implementing this
system, libraries can streamline their operations, enhance user experience, and
maintain accurate records of book transactions.

You might also like