Asmt 1.2
Asmt 1.2
Objective
Create a Java console application to manage a library system, where users can:
Functional Requirements
1. Book Class (Book)
Instance Variables:
o String title – stores the book’s title.
o String author – stores the book’s author.
Constructor:
o Book(String title, String author) – initializes the book’s title and author.
Method:
o void display() – prints the book details in "Title by Author" format.
2.1. Fields:
2.2. Constructor:
2.3. Methods:
✅ void displayBooks():
✅ int countBooks():
Non-Functional Requirements
✅ The program should handle incorrect inputs (e.g., empty titles, duplicates).
✅ Use loops for the menu and input collection.
✅ Use arrays to store books.
✅ Follow OOP principles (encapsulation, modularity).
Menu:
1. Add Book
2. Display Books
3. Search for a Book
4. Count Books
5. Exit
Enter choice: **1**