b’c277f6e4d9d31dd8451edc51734b5aa5f3af35′
blob 530�package programmingexample6;
public class FreeShippingDecorator extends Decorator {
private int maxWeight;
private double minPrice;
public FreeShippingDecorator(Product product, double minPrice, int maxWeight) {
super(product);
this.maxWeight = maxWeight;
this.minPrice = minPrice;
}
@Override
public double getShippingCost() {
if (getWeight() < maxWeight && getPrice() > minPrice)
return 0;
else
return super.getShippingCost();
}
}