← Back to Home

Sprint Challenge

Challenge Overview

This sprint challenge assesses your understanding of advanced Java concepts including design patterns, inheritance, polymorphism, exception handling, and hashing. You will demonstrate your ability to apply these concepts in practical scenarios.

Learning Objectives Tested:

Challenge Tasks:

  1. Design Pattern Implementation: Implement a specified design pattern in the provided codebase
  2. Inheritance Exercise: Create a class hierarchy with proper method overriding
  3. Hash Implementation: Implement hashCode() and equals() for a given class
  4. Exception Handling: Add proper exception handling to an existing application
  5. Debugging Exercise: Find and fix bugs in a provided codebase

Example Implementation (Design Pattern):

// Example Strategy Pattern Implementation
public interface PaymentStrategy {
    void pay(double amount);
}

public class CreditCardPayment implements PaymentStrategy {
    private String cardNumber;
    private String name;
    
    public CreditCardPayment(String cardNumber, String name) {
        this.cardNumber = cardNumber;
        this.name = name;
    }
    
    @Override
    public void pay(double amount) {
        System.out.println(amount + " paid using credit card ending with " 
            + cardNumber.substring(cardNumber.length() - 4));
    }
}

public class PayPalPayment implements PaymentStrategy {
    private String email;
    
    public PayPalPayment(String email) {
        this.email = email;
    }
    
    @Override
    public void pay(double amount) {
        System.out.println(amount + " paid using PayPal account: " + email);
    }
}

public class ShoppingCart {
    private PaymentStrategy paymentStrategy;
    
    public void setPaymentStrategy(PaymentStrategy paymentStrategy) {
        this.paymentStrategy = paymentStrategy;
    }
    
    public void checkout(double amount) {
        paymentStrategy.pay(amount);
    }
}

Setup Instructions

  1. Fork and clone the Sprint Challenge Repository
  2. Open the project in your IDE
  3. Complete the challenges in the README.md file
  4. Submit your solution by creating a pull request

Resources