⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 percentdiscountpricingstrategy.java

📁 网上购物系统,实现了一个具体的框架
💻 JAVA
字号:
/**
 * @name PercentDiscountPricingStrategy.java
 * @author Administrator/pan
 * @version 1.1
 * @date 2008/2/16
 */
package com.digitstore.process.server.sale;

import com.digitstore.process.sale.Sale;

public class PercentDiscountPricingStrategy implements ISalePricingStrategy {
	//商品折扣率
	private double percentage;
	
	//构造函数
	public PercentDiscountPricingStrategy(){}
	
	public PercentDiscountPricingStrategy(double percentage){
		this.percentage = percentage;
	}
	//对应的get/set方法
	public double getPercentage(){
		return percentage;
	}
	
	public void setPercentage(double percentage){
		this.percentage = percentage;
	}
    //获取折扣后的价格
	public double getTotal(Sale sale) {
		return (sale.getTotal()*percentage);
		
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -