A Java Swing-based Object-Oriented Programming (OOP) application designed to load, manage, search, and analyze a library's catalogue database. The system handles various library item types including Books, CDs, and DVDs, and supports processing loan statistics to compute analytics such as the top-performing loans.
-
Multi-Category Catalogue Support: Load and manage different item categories:
- Books: Catalogued with author and page count details.
- CDs: Catalogued with artist and track details.
- DVDs: Catalogued with director and runtime details.
-
Fast Search & Lookup:
- Instant
$O(1)$ lookups by OCLC (Unique identifier) using HashMaps. - Category-wide searches and list filtering by Genre.
- Instant
-
Reports & Diagnostics:
- Generate full catalogue summaries.
- Generate genre-specific reports.
- Save generated reports directly to local files (
catalogue_report.txt).
-
Loan Statistics Analytics:
- Load external loan records.
- Identify and report the Top 10 most-loaned library items.
- User-Friendly Swing Dashboard: A clean GUI featuring tabbed selection, search text-fields, action buttons, and a monospaced scrollable console log to view detailed outputs.
This project serves as a showcase for core Object-Oriented Programming (OOP) concepts in Java:
- Abstraction:
- Uses an abstract base class
LibraryItemto define common attributes and force concrete subclasses (Book,CD,DVD) to implement their category-specific metadata andtoString()representation.
- Uses an abstract base class
- Inheritance:
- Subclasses inherit common properties (OCLC, Title, Genre, Publication Year) from the parent
LibraryItemclass.
- Subclasses inherit common properties (OCLC, Title, Genre, Publication Year) from the parent
- Encapsulation:
- Uses protected fields, final attributes, and public getter methods to hide internal implementation and expose read-only state.
- Polymorphism:
- Dynamically resolves category types and
toString()formatting at runtime depending on the actual subclass instance.
- Dynamically resolves category types and
├── Data/ # Sample catalog & loan record TXT files
├── src/ # Source Java files
│ ├── Main.java # App entry point
│ ├── DashBoard.java # Swing GUI and Event Listeners
│ ├── LibraryItem.java # Abstract base class
│ ├── Book.java # Book representation
│ ├── CD.java # CD representation
│ ├── DVD.java # DVD representation
│ ├── CatalogueLoader.java # File reader & parser helper
│ ├── ReportGenerator.java # Exporters for reports
│ └── LoanStat.java # Model for loan records
├── .gitignore # Git exclusions configuration
└── README.md # Project documentation
- Java Development Kit (JDK): Version 8 or higher installed on your computer.
Navigate to the root directory of the project in your terminal and compile all Java source files:
javac -d out src/*.javaRun the compiled Java bytecode class:
java -cp out MainTo test the file loading capabilities, use the text files provided in the Data/ directory.
- Catalogues: Tab or comma-separated item files.
- Loans: Files containing OCLC numbers alongside loan statistics.