Skip to content

πŸ“š Library Management System β€” Java Console Project with book borrowing, fine tracking, due date enforcement, and admin / user dashboard β€” all with data persistence and logging.

License

Notifications You must be signed in to change notification settings

dinesh38555/Library-Management-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“š Library Management System (Java Console Application)

Java License: MIT Platform Status Data Persistence Logging

A feature-rich Library Management System built in Java using the console. This project is designed to manage library operations such as book borrowing, returning, fine tracking, and transaction logging β€” all with persistent storage using serialization.


βœ… Features

  • πŸ“– Book Management
    • Add, Delete, Search, List books
  • πŸ‘€ User Registration & Login
    • Each user has their own borrowing history
  • πŸ”„ Borrow & Return Books
    • Books can only be borrowed if they are available
  • ⏰ Due Date Tracking
    • Books must be returned within 7 days
  • πŸ’° Fine System
    • β‚Ή10/day fine after due date
    • Borrowing is blocked if outstanding fine > β‚Ή50
    • Users can pay partial or full fine via "Pay Fine" menu
  • πŸ“‚ Data Persistence
    • All user and book data is stored using .ser files
  • 🧾 Transaction Logging
    • All borrow and return operations are logged to a text file
  • πŸ“ˆ Admin Dashboard
    • View total fines collected across all users
  • πŸ“‘ Export to CSV
    • Export current book list to books.csv
  • πŸ”’ Admin Mode
    • Protected with password (admin123 by default)

πŸ§ͺ Sample Data

The repository includes a sample books.csv file under data/ so you can test the system immediately after cloning. Other files like .ser and logs are generated after first run and are excluded from GitHub using .gitignore.


πŸ› οΈ Technologies Used

  • Language: Java (Object-Oriented Programming, Collections)
  • Persistence: Java Serialization (.ser files)
  • Logging: Text-based logging via transaction_log.txt
  • I/O: Reading/writing CSV, file-based storage

πŸ“ Project Structure

LibraryManagementSystem/
β”‚
β”œβ”€β”€ data/ # Stores persistent and runtime data
β”‚ β”œβ”€β”€ books.csv # Sample book data (versioned)
β”‚ β”œβ”€β”€ users_data.ser # Saved user objects (ignored in Git)
β”‚ β”œβ”€β”€ library_data.ser # Saved book objects (ignored in Git)
β”‚ └── transaction_log.txt # Log of all transactions (ignored in Git)
β”‚
β”œβ”€β”€ src/ # Java source code
β”‚ β”œβ”€β”€ Main.java # Entry point
β”‚ β”œβ”€β”€ models/
β”‚ β”‚ β”œβ”€β”€ Book.java
β”‚ β”‚ └── User.java
β”‚ β”œβ”€β”€ services/
β”‚ β”‚ β”œβ”€β”€ LibraryService.java
β”‚ β”‚ └── FileHandler.java
β”‚ └── utils/
β”‚ └── TransactionLogger.java
β”‚
β”œβ”€β”€ README.md # This file
└── .gitignore # Git ignore rules

πŸš€ How to Run

  1. Clone the repository

    git clone https://github.com/dinesh38555/Library-Management-System.git
    cd Library-Management-System
  2. Compile the Java code

    javac -d bin src/**/*.java
  3. Run the application

    java -cp bin Main
  4. Use the Console Menu

    Choose between User or Admin access. Register/Login β†’ Borrow books β†’ Return books β†’ Pay fines.

πŸ” Admin Login

Default Password: admin123

(Can be changed in LibraryService.java's adminPassword field)

Admin options include:

  • View all transaction logs
  • View total fines collected
  • Export books list to CSV

πŸ’΅ Fine System Logic

  • Every borrowed book has a 7-day deadline.
  • After 7 days, a fine of β‚Ή10/day is applied.
  • Borrowing is blocked until the total outstanding fine is β‚Ή50 or less.
  • Users can pay partial or full fines using the menu.
  • Admin can track total fines collected across all users.

πŸ“Š Demo Tips

To effectively test the fine system without waiting:

  • Simulate a late return:
    1. Borrow a book as a user.
    2. Temporarily modify the borrowedDate in your code (e.g., in LibraryService.java, you can set book.setBorrowedDate(LocalDate.now().minusDays(10));). Remember to remove this line after testing.
    3. Return the book to observe the fine calculation.
  • Pay the fine: Use the "Pay the pending fines" option from the user menu.
  • Verify as Admin: Switch to admin mode to view transaction logs and total collected fines.

πŸ“ Notes

  • Runtime data (*.ser, transaction_log.txt) is not pushed to GitHub.
  • Only books.csv is tracked for demo/testing.
  • The entire application runs in the console β€” no GUI required. You can easily extend this to a JavaFX/Swing GUI.

πŸ“£ Contributions

Want to improve this system? Feel free to fork the repository and raise a pull request! Ideas for features include:

  • GUI (JavaFX or Swing)
  • Role-based access
  • Search filters
  • REST API backend
  • SQLite or MySQL integration

πŸ“„ License

This project is licensed under the MIT License.

About

πŸ“š Library Management System β€” Java Console Project with book borrowing, fine tracking, due date enforcement, and admin / user dashboard β€” all with data persistence and logging.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages