0% found this document useful (0 votes)
5 views

Library_Book_Management_Report

The Library Book Management System is a Java-based application designed to manage a small library's book collection through CRUD operations and file handling. It utilizes Object-Oriented Programming principles for efficient book record management. The system allows users to add, search, delete, and modify book records while ensuring persistent storage of data.

Uploaded by

Tannu Patel
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Library_Book_Management_Report

The Library Book Management System is a Java-based application designed to manage a small library's book collection through CRUD operations and file handling. It utilizes Object-Oriented Programming principles for efficient book record management. The system allows users to add, search, delete, and modify book records while ensuring persistent storage of data.

Uploaded by

Tannu Patel
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Project Report

Library Book Management System

1. Introduction
The Library Book Management System is a simple Java-based application that allows users
to add, search, delete, modify, and display book records. It helps in managing a small
library's book collection efficiently using Object-Oriented Programming (OOP) principles
like Encapsulation and File Handling.

2. Objectives
• To develop a system for managing library books efficiently.
• To implement CRUD (Create, Read, Update, Delete) operations.
• To use file handling for storing book records persistently.
• To apply Object-Oriented Programming principles in Java.

3. Technologies Used
Technology Purpose
Java Core programming language used
File Handling Stores book records in a text file
OOP Principles Encapsulation, Abstraction, and
Polymorphism
HashMap Efficient book storage and retrieval

4. Code Implementation

A) LibraryBookManagement.java

import java.util.HashMap;
import java.util.Scanner;
import java.io.*;

class LibraryBookManagement {
private static HashMap<String, String> books = new HashMap<>();

public static void main(String[] args) {


boolean running = true;
Scanner scanner = new Scanner(System.in);
while (running) {
System.out.println("\n1. Add Book\n2. Search Book\n3. Delete Book\n4. Modify
Book\n5. Display Books\n6. Exit");
System.out.print("Enter your choice: ");
int choice = scanner.nextInt();
scanner.nextLine();

switch (choice) {
case 1:
System.out.print("Enter Book Title: ");
String title = scanner.nextLine();
System.out.print("Enter Author Name: ");
String author = scanner.nextLine();
books.put(title, author);
saveBooksToFile();
System.out.println("Book added successfully.");
break;

case 2:
System.out.print("Enter Book Title to Search: ");
String searchTitle = scanner.nextLine();
System.out.println(books.containsKey(searchTitle) ? "Author: " +
books.get(searchTitle) : "Book not found.");
break;

case 3:
System.out.print("Enter Book Title to Delete: ");
String deleteTitle = scanner.nextLine();
books.remove(deleteTitle);
saveBooksToFile();
System.out.println("Book deleted successfully.");
break;

case 4:
System.out.print("Enter Book Title to Modify: ");
String modifyTitle = scanner.nextLine();
System.out.print("Enter New Author Name: ");
String newAuthor = scanner.nextLine();
books.put(modifyTitle, newAuthor);
saveBooksToFile();
System.out.println("Book details updated.");
break;
case 5:
System.out.println("Library Books:");
for (String key : books.keySet()) {
System.out.println("Title: " + key + " | Author: " + books.get(key));
}
break;

case 6:
running = false;
System.out.println("Exiting Library Management System...");
break;

default:
System.out.println("Invalid choice. Try again.");
}
}
scanner.close();
}

public static void saveBooksToFile() {


try (BufferedWriter writer = new BufferedWriter(new FileWriter("books.txt"))) {
for (String title : books.keySet()) {
writer.write(title + "," + books.get(title));
writer.newLine();
}
System.out.println("Book records saved successfully.");
} catch (IOException e) {
System.out.println("Error saving book records.");
}
}
}

5. Conclusion
The Library Book Management System is a simple yet effective solution for managing a
small library's collection. It allows users to add, search, delete, and modify book records
efficiently. With file handling, book records are stored persistently, making the system
practical for real-world use.

You might also like