A monolith console-based Library Management System built in Java, supporting Admin and Borrower workflows with full book borrowing lifecycle, fine management, and detailed reporting.
LibraryManagementSystem/
│
├── Main.java
│
├── auth/
│ └── AuthService.java
│
├── models/
│ ├── User.java
│ ├── Admin.java
│ ├── Borrower.java
│ ├── Book.java
│ ├── BorrowRecord.java
│ └── Fine.java
│
├── data/
│ └── DataStore.java
│
├── services/
│ ├── BookService.java
│ ├── BorrowService.java
│ ├── FineService.java
│ └── ReportService.java
│
├── menus/
│ ├── AdminMenu.java
│ └── BorrowerMenu.java
│
└── utils/
├── InputHelper.java
└── DateHelper.java
# Navigate to the project root
cd LibraryManagementSystem
# Compile
javac -d out -sourcepath . Main.java
# Run
java -cp out MainMake sure you have Java 8 or above installed.
| Role | Password | |
|---|---|---|
| Admin | admin@library.com | admin123 |
| Borrower | hareram@gmail.com | pass123 |
New users can only be added by an Admin. There is no self-signup.
- Login with Email and Password
- Role-based menu routing (Admin / Borrower)
- No public signup — Admin registers all users
- Borrower menu shows live caution deposit, security deposit, and active borrow count on every screen
- Add, modify, and delete books
- Cannot delete a book if copies are currently borrowed
- View all books sorted by Title or Available Quantity
- Search books by Title or ISBN
- Manage borrower fine limit:
- Set security deposit (minimum ₹500 required to borrow)
- Add to caution deposit
- Add new Admins and Borrowers into the system
- View all available books (only in-stock books shown)
- Borrow a book by Book ID, ISBN, or Title
- Maximum 3 books borrowed at a time
- Cannot borrow the same book twice simultaneously
- Minimum security deposit of ₹500 required to borrow
- Return a book with user-provided return date (DD/MM/YYYY)
- Extend borrow tenure (max 2 times, 15 days each extension)
- Exchange a borrowed book with another available book
- Mark a book as lost
- Report membership card as lost
- Late return fine with exponential growth:
- Base rate: ₹2 per day for first 10 days late
- Doubles every subsequent 10-day period (₹4/day, ₹8/day...)
- Capped at 80% of the book's cost — whichever is lower
- Lost book fine: 50% of book's actual cost
- Lost membership card fine: flat ₹10
- Fine payment options:
- Pay by cash
- Deduct from caution deposit (₹1,500 preloaded on signup)
- Partial deduction if caution is insufficient — remainder by cash
- All fines recorded with reason, amount, and payment mode
Admin Reports:
- Low stock books (available quantity below 3)
- Books never borrowed by anyone
- Heavily borrowed books sorted by borrow count
- Outstanding unreturned books as on a given date
- Book status by ISBN — shows who has borrowed it and expected return date
Borrower Reports:
- Personal fine history with reason and payment status
- Personal borrow history with dates and return status
- OOP: Inheritance (
Admin extends User,Borrower extends User) - Polymorphism:
instanceofchecks and casting - Collections:
ArrayListwith lambda-basedComparatorsorting - Date handling:
java.time.LocalDate,ChronoUnit.DAYS,DateTimeFormatter - Exponential calculation:
Math.pow()for fine growth per 10-day period - Packages: Organized into
auth,models,data,services,menus,utils - Static DataStore: Shared in-memory state across the entire application
| Scenario | Fine |
|---|---|
| Days 1–10 late | ₹2 per day |
| Days 11–20 late | ₹4 per day |
| Days 21–30 late | ₹8 per day |
| Every next 10 days | Doubles from previous period |
| Maximum cap | 80% of book cost |
| Lost book | 50% of book cost |
| Lost membership card | ₹10 flat |
Book cost ₹450, returned 25 days late:
- Days 1–10 → 10 × ₹2 = ₹20
- Days 11–20 → 10 × ₹4 = ₹40
- Days 21–25 → 5 × ₹8 = ₹40
- Total = ₹100 → Cap = ₹360 → Final fine = ₹100
- All data is stored in-memory. Data resets on every run.
- Default books and users are preloaded in
DataStore.init()for testing. - Return date is entered manually by the user in DD/MM/YYYY format.
- Caution deposit starts at ₹1,500 per borrower and is refunded on account closure.
- Security deposit (minimum ₹500) must be set by admin before a borrower can borrow.