You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1yl/PercentageDiscount.java

22 lines
445 B

package ;
/**
* @author The Administrator
* @version 1.0
* @created 26-10月-2025 20:20:19
*/
public class PercentageDiscount implements DiscountStrategy {
private final double rate = 0.1; // 10%
public PercentageDiscount(){
// default constructor
}
public void finalize() throws Throwable {
}
public double calculateDiscount(double amount) {
return amount * rate;
}
}//end PercentageDiscount