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.
22 lines
445 B
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
|