
import java.math.BigDecimal;
import java.util.Calendar;

public class ProductShipperV2 {
    private static final float COST_PER_KILOGRAM = 1.25f;
    private static final float CHRISTMAS_LOADING = 2f;
    private ProductShipperCalendar calendar;

    public BigDecimal calculateShippingCharges(Product product) {
        float weightInKilograms = product.getWeightInKilograms();
        if (weightInKilograms <= 0) {
            throw new IllegalArgumentException("Product has an invalid weight of " + weightInKilograms);    
        }

        BigDecimal charges = new BigDecimal(weightInKilograms * COST_PER_KILOGRAM);

        return charges.add(new BigDecimal(calculateAdditionalCharges()));
    }

    public void setCalendar(ProductShipperCalendar calendar) {
        this.calendar = calendar;
    }

    private float calculateAdditionalCharges() {
        if (duringChristmasPeriod()) {
            return CHRISTMAS_LOADING;
        }

        return 0f;
    }

    private boolean duringChristmasPeriod() {
        int month = calendar.getMonth();
        int day = calendar.getDay();

        return month == 11 && day > 23 && day < 31;
    }

}
