拓胜技术专家教你如何深入理解设计模式(策略模式).pdfVIP

  • 3
  • 1
  • 约2.06万字
  • 约 28页
  • 2015-09-26 发布于重庆
  • 举报

拓胜技术专家教你如何深入理解设计模式(策略模式).pdf

拓胜技术专家教你如何深入理解设计模式(策略模式)

—— (Strategy) 1.1 CRM 5% 10% 1.2 /** * */ public class Price { 1/28 /** * * @param goodsPrice * @param customerType * @return */ public double quote(double goodsPrice,String customerType){ if(customerType.equals()){ System.out.println(); return goodsPrice; }else if(customerType.equals()){ System.out.println(5%); return goodsPrice*(1-0.05); }else if(customerType.equals()){ System.out.println(10%); return goodsPrice*(1-0.1); } // return goodsPrice; } } 1.3 /** * */ public class Price { /** * * @param goodsPrice * @param customerType * @return */ public double quote(double goodsPrice,String customerType){ 2/28 if(customerType.equals()){ return this.calcPriceForNormal(goodsPrice); }else if(customerType.equals()){ return this.calcPriceForOld(goodsPrice); }else if(customerType.equals()){ return this.calcPriceForLarge(goodsPrice); } // return goodsPrice; } /** * * @param goodsPrice * @return */ private double calcPriceForNormal(double goodsPrice){ System.out.println(); return goodsPrice; } /** * * @param goodsPrice * @return */ private double calcPriceForOld(double goodsPrice){ System.out.println(5%); return goodsPrice*(1-0.05); } /** * * @param goodsPrice * @return */ private double calcPriceForLarge(double goodsPrice){ System.out.println(10%); return goodsPrice*(1-0.1);

文档评论(0)

1亿VIP精品文档

相关文档