LIBRARY MANAGER
A console-based library system in pure Java, built to practise object-oriented design: books and periodicals, customers, and the rules for borrowing between them.
OVERVIEW
One of my first complete programs: a menu-driven library manager that runs in the terminal with no external dependencies. Everything lives in memory while the program runs, so the focus stays on modelling the domain cleanly — what a book is, what a customer can do, and which rules the library must enforce.
HOW IT IS ORGANIZED
Books
The base item: auto-generated ID, title, pages, author, availability, and — when borrowed — who has it and since when.
Periodical
Extends
Books with a type (paper, scientific paper, or magazine) and its own way of printing details.Customer
Name, a private phone number behind a getter and setter, and a three-slot cart of borrowed items.
Library
Every console menu and prompt, kept apart from the domain classes.
Main
The main loop that routes menu choices to Library actions until the user exits.
WHAT THE USER CAN DO
01AddRegister books, periodicals, and customers; each gets the next ID automatically.
02PreviewList all books, only the available ones, only the borrowed ones, all customers, or the customers who currently have items — or open one book or customer in detail.
03BorrowPick a customer, see their current cart, then pick from the books still available.
04ReturnReturn an item from a customer’s cart, which frees both the slot and the book.
05DeleteRemove customers or items — subject to the rules below.
BUSINESS RULES
- Three items per customer: a fourth borrow is refused with a clear message.
- One borrower per item: trying to borrow a book that is out shows who has it.
- Borrowed items cannot be deleted until they are returned.
- Borrow date is recorded automatically and shown in the item’s details.
OOP IN PRACTICE
Encapsulation
The customer’s phone number is private and only reachable through accessor methods.
Inheritance
Periodical reuses everything a book has and only adds what is different.Polymorphism
Periodical overrides the details printout, so the same call shows the right information for either item type.Class-level state
Static counters generate IDs and track available items across every instance.
RUN IT
git clone https://github.com/AAFLY99/library-management-system-java-noGui.git cd library-management-system-java-noGui/src javac library/*.java java library.Main
WHAT I WOULD DO DIFFERENTLY NOW
Persist data to a database or file so it survives a restart, replace the static collections with a repository class, and move console I/O fully out of the model so the same logic could sit behind a GUI or a web API.