AJP MicroProject
AJP MicroProject
Objective:
Design and document a console-based library
management system using Java, incorporating
object-oriented programming (OOP) principles, and
basic database or file operations. The system
should manage users and books, support
borrowing/returning books, and provide basic
search and profile management functionalities. This
document will guide the design, development, and
documentation stages, ensuring all functionalities
are implemented systematically.
Features:
1. Add/Remove books
2. Search books by title/author
3. Display all books
4. Borrow/Return books
5. Display borrowed books
Technical Requirements:
1. Java 8 or later
2. Eclipse or IntelliJ IDEA
3. Java Collections Framework (e.g.,
ArrayList, HashMap)
4. File handling (e.g., FileReader,
FileWriter)
Deliverables:
Design Considerations:
Object-Oriented Programming (OOP)
Principles
Encapsulation: Each class will encapsulate its
own data and methods, restricting access
where appropriate.
Inheritance: Common behaviors will be
grouped into base classes, allowing specialized
child classes for users and book items.
Polymorphism: Methods with similar
functionality will be dynamically handled,
supporting multiple object types.
Tools:
Diagramming Tools
Use Lucidchart (or any preferred UML tool) for
creating UML diagrams.
Documentation Tools
Microsoft Word or Google Docs for
documentation, ensuring clarity and
professional formatting.
UML Notation
Adhere to standard UML notation for diagrams,
maintaining consistency and accuracy
throughout the documentation.
Project Structure:
1. Introduction
Briefly describe the purpose and scope of the
library management system, including target
users and expected functionalities.
2. System Overview
Provide an overview of the system architecture,
key features, and how it addresses user needs.
3. System Design
o Class Diagram: Define system classes,
6. Conclusion
Summarize the functionality and design aspects
of the library management system, highlighting
key design principles and anticipated impact.
Grading Criteria:
Program :
Project Structure:
Implementation:
Book.java
Library.java
import java.util.ArrayList;
import java.util.HashMap;
import (link unavailable)*;
public Library() {
books = new ArrayList<>();
bookMap = new HashMap<>();
}
// Add book
public void addBook(Book book) {
books.add(book);
bookMap.put(book.getTitle(), book);
}
// Remove book
public void removeBook(String title) {
Book book = bookMap.get(title);
if (book != null) {
books.remove(book);
bookMap.remove(title);
}
}
// Search book
public Book searchBook(String title) {
return bookMap.get(title);
}
// Borrow/Return book
public void borrowBook(String title) {
Book book = bookMap.get(title);
if (book != null) {
book.setBorrowed(true);
}
}
Main.java
import java.util.Scanner;
while (true) {
System.out.println("1. Add book");
System.out.println("2. Remove book");
System.out.println("3. Search book");
System.out.println("4. Display all
books");
System.out.println("5. Borrow book");
System.out.println("6. Return book");
System.out.println("7. Display borrowed
books");
System.out.println("8. Exit");
switch (choice) {
case 1:
// Add book logic
break;
case 2:
// Remove book logic
break;
// ...
}
}
}
}
Output :
Initial Output
1. Add book
2. Remove book
3. Search book
4. Display all books
5. Borrow book
6. Return book
7. Display borrowed books
8. Exit
Add Book
Enter choice: 1
Enter book title: Java Programming
Enter book author: John Smith
Book added successfully!
Display All Books
Enter choice: 4
List of books:
Java Programming by John Smith
Add Another Book
Enter choice: 1
Enter book title: Data Structures
Enter book author: Jane Doe
Book added successfully!
Display All Books
Enter choice: 4
List of books:
Java Programming by John Smith
Data Structures by Jane Doe
Search Book
Enter choice: 3
Enter book title: Java Programming
Book found:
Java Programming by John Smith
Borrow Book
Enter choice: 5
Enter book title: Java Programming
Book borrowed successfully!
Display Borrowed Books
Enter choice: 7
List of borrowed books:
Java Programming by John Smith
Return Book
Enter choice: 6
Enter book title: Java Programming
Book returned successfully!
Exit
Enter choice: 8
Exiting program...
Conclusion :
- Summarize the functionality and design
aspects of the library management system,
highlighting key design principles and anticipated
impact.
Reference :
Meta Ai, ChatGPT, Google.