← Back to Home

Sprint Challenge: Java OOP

This sprint challenge is designed to assess your understanding of Java Object-Oriented Programming concepts covered in this unit.

Submission Deadline: Friday at 5:00 PM

Overview

In this sprint challenge, you will design and implement a Library Management System using the Java OOP principles we've covered: encapsulation, inheritance, polymorphism, and generics. Your system should be well-structured, maintainable, and demonstrate proper use of these concepts.

Instructions

Project Setup

Create a new Java project with the following structure:

LibrarySystem/
├── src/
│   ├── model/
│   │   ├── items/
│   │   ├── users/
│   │   └── library/
│   ├── util/
│   └── Main.java
└── README.md

Part 1: Core Item Classes

Design and implement the core classes for library items:

  1. Create an abstract LibraryItem class with common properties like id, title, isAvailable, etc.
  2. Implement concrete item classes: Book, DVD, and Magazine extending LibraryItem
  3. Include appropriate constructors, getters/setters, and override toString() method
  4. Add specialized methods and properties specific to each item type

Part 2: User Classes

Create user-related classes:

  1. Implement a User class with properties like id, name, contactInfo, etc.
  2. Create two types of users by extending the User class: Student and Faculty
  3. Add different borrowing privileges for each user type (e.g., students can borrow up to 5 items, faculty up to 10)

Part 3: Library Management

Implement the core functionality of the library system:

  1. Create a Library class to manage the collection of items and users
  2. Implement methods for adding items, registering users, borrowing/returning items
  3. Use appropriate data structures to store the collections
  4. Implement proper validation and error handling

Part 4: Generics Implementation

Demonstrate your understanding of generics:

  1. Create a generic Catalog<T extends LibraryItem> class to manage different types of items
  2. Implement a PairContainer<K, V> class that can be used to store key-value pairs (e.g., for tracking borrowed items)
  3. Create appropriate utility methods that use wildcards or bounded type parameters

Part 5: Main Application

Create a main application that demonstrates your system:

  1. In Main.java, create a simple demo showing how your system works
  2. Create sample items and users
  3. Demonstrate borrowing and returning items
  4. Show how different user types have different privileges
  5. Include examples of using your generic classes

Requirements

Submission Requirements

  • Submit a ZIP file containing your project directory
  • Include a README.md file explaining how to run your application and any design decisions you made
  • Code should be well-documented with appropriate comments
  • Follow Java naming conventions and best practices

Grading Criteria

  • Encapsulation (20%): Proper use of access modifiers, getters/setters, and defensive copying
  • Inheritance and Polymorphism (25%): Effective class hierarchy and use of polymorphic methods
  • Generics (25%): Correct implementation of generic classes and methods
  • Functionality (20%): Working system that meets all requirements
  • Code Quality (10%): Clean, readable code following best practices

Resources