A clean, console-based application demonstrating core Java principles including Object-Oriented Programming (OOP), Data Structures, and Static vs. Non-Static logic.
- Custom Book Objects: Uses a
Bookclass to store individual attributes like title and availability. - HashMap Inventory: Implements a
HashMap<String, Book>for high-performance searching using ISBN as the unique key. - Global Tracking: Uses a
staticvariable (totalBooksCreated) to track how many books have been added to the system globally. - Interactive Menu: A robust
whileloop andswitchstatement that handles user input through aScanner. - Transaction Logic: Refined logic for adding, finding, checking out, and returning books with accurate status updates.
- Static (
totalBooksCreated): Belongs to theBookclass itself. Every time a newBookis instantiated, this global counter increases. - Non-Static (
title,isCheckedOut): Unique to each specific book instance. Checking out "Java 101" does not affect the status of "Python Basics."
Instead of looping through an array to find a book, this system uses bookCollection.get(isbn). This allows for O(1) time complexity, meaning the search speed stays the same whether you have 10 books or 10,000.
While the current version provides a strong foundation, the following features are planned for future updates:
- Data Persistence: Adding File I/O (using
FileWriterandBufferedReader) so that library data isn't lost when the program is closed. - Auto-Save Logic: Triggering a save function after every "Add" or "Checkout" to ensure data integrity.
- Search by Title: Creating a method to iterate through the HashMap values to find books by title instead of just ISBN.
- Borrower Logging: A secondary HashMap to track who has borrowed which ISBN.
- Copy the three classes (
Book,Library,Main) into your Java IDE. - Run the
Mainclass. - Use the numeric menu to manage your library directly from the console!
Collaborators are welcomed! I am using this project to explore Java fundamentals. If you want to help implement the roadmap items, optimize the code, or suggest new features, feel free to fork this repository, open an issue, or submit a pull request. Let's build and learn together!
Prashant - GitHub Profile