🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101

Library management system

A console app to manage books and members: issue, return, fines and search, designed with clean classes.

Beginner⏱ 8–12 hours🊜 7 stepsJavaOOPCollections

What you'll learn

  • ◆Classes, encapsulation and interfaces
  • ◆ArrayList and HashMap
  • ◆Dates with java.time

What you'll build

  • ✓Add, search and remove books
  • ✓Register members
  • ✓Issue and return with due dates
  • ✓Fine of â‚đ2 per late day

Step-by-step guide

  1. 1

    Model the classes

    Book (isbn, title, author, available), Member (id, name), Loan (book, member, issueDate, dueDate, returnDate).

  2. 2

    Create a Library service

    Hold Map<String, Book> books, Map<Integer, Member> members and List<Loan> loans; put all rules here, not in main.

  3. 3

    Issue a book

    Check the book exists and is available, the member has fewer than 3 books, then create a Loan with dueDate = LocalDate.now().plusDays(14).

  4. 4

    Return and fines

    Set returnDate; fine = ChronoUnit.DAYS.between(dueDate, returnDate) * 2 if positive.

  5. 5

    Search

    Use streams: books.values().stream().filter(b -> b.getTitle().toLowerCase().contains(q)).toList().

  6. 6

    Menu

    A Scanner loop in Main with options 1–7; catch InputMismatchException for bad input.

  7. 7

    Save data

    Persist books and members to CSV files on exit and load them at start (or use Java serialization).

🚀 Make it stand out

  • +Store data in MySQL with JDBC
  • +Add a Swing or JavaFX GUI
  • +Write JUnit tests for the fine rules