Skip to content

a real-world example question that can be solved using Java basics

Notifications You must be signed in to change notification settings

IT21826740/Library-Book-Management

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Library-Book-Management

a real-world example question that can be solved using Java basics:

Question: Library Book Management

Problem Statement

You are tasked with developing a simple program to manage books in a small library. The library needs to keep track of its books, allowing the librarian to perform the following actions:

  1. Add a new book to the collection.
  2. Display the details of all books in the collection.
  3. Search for a book by its title.

Each book has the following attributes:

  • Title
  • Author
  • ISBN (International Standard Book Number)
  • Published Year

Requirements

  1. Add a Book:

    • Prompt the user to enter the details of a new book.
    • Store the book in a list.
  2. Display Books:

    • Display the details of all books in the collection.
  3. Search a Book:

    • Prompt the user to enter the title of the book they want to search for.
    • Display the details of the book if found; otherwise, display a message saying the book is not found.

Constraints

  • Use only basic Java constructs: classes, methods, arrays (or ArrayList), loops, and basic input/output.

Example

Enter 1 to add a book, 2 to display all books, 3 to search for a book, 4 to exit: 1
Enter Title: Java Programming
Enter Author: John Doe
Enter ISBN: 1234567890
Enter Published Year: 2020

Enter 1 to add a book, 2 to display all books, 3 to search for a book, 4 to exit: 2
Title: Java Programming, Author: John Doe, ISBN: 1234567890, Published Year: 2020

Enter 1 to add a book, 2 to display all books, 3 to search for a book, 4 to exit: 3
Enter Title to search: Java Programming
Title: Java Programming, Author: John Doe, ISBN: 1234567890, Published Year: 2020

Enter 1 to add a book, 2 to display all books, 3 to search for a book, 4 to exit: 4
Goodbye!

This example uses basic Java constructs to solve a practical problem, making it an excellent exercise for those learning Java basics.

SELF TRY

Releases

No releases published

Packages

No packages published

Languages