当前位置: 首页 > news >正文

做博客网站如何盈利广东seo快速排名

做博客网站如何盈利,广东seo快速排名,网上还有什么网站做批发,中装建设集团官网FullDiscount Strategy,策略模式:定义一系列的算法,把他们一个个封装起来, 并使他们可以互相替换,本模式使得算法可以独立于使用它们的客户。 场景:购物车结算时,根据不同的客户,…

FullDiscount 

Strategy,策略模式:定义一系列的算法,把他们一个个封装起来,
并使他们可以互相替换,本模式使得算法可以独立于使用它们的客户。

场景:购物车结算时,根据不同的客户,计算不同的折扣策略,先定义个折扣策略基类Discount,各种不同的折扣定义子类来继承。根据实际的情况,再将折扣策略传给购物车对象进行订单的结算。

类图:

PatterTest类调用购物车ShoppingCart测试,ShoppingCart传入Discount来计算折扣。

Discount.java基类

package com.figo.study2024.pattern.strategy;/*** 计算折扣接口*/
public interface Discount {public int calculate(int money);
}
package com.figo.study2024.pattern.strategy;/*** 满减*/
public class FullDiscount implements Discount {@Overridepublic int calculate(int money) {if (money > 200){System.out.println("优惠减免20元");return money - 20;}return money;}
}
package com.figo.study2024.pattern.strategy;/*** 首次购*/
public class NewerDiscount implements Discount {@Overridepublic int calculate(int money) {if (money > 100){return money - 20;}return money;}
}
package com.figo.study2024.pattern.strategy;
/*** 测试策略模式* 购物车费用结算过程*/
public abstract class ShoppingCart {private Discount discount;public void setDiscount(Discount discount) {this.discount = discount;}//提交订单主流程public void submitOrder(){//计算商品金额int money = balance();System.out.println("商品总金额为:"+money+"元");//优惠减免money = discount.calculate(money);System.out.println("优惠减免后:"+ money+"元,");//保存及支付订单pay(money);//送货上门sendHome();}//计算金额private int balance(){int money = 280;//TODO 累加商品金额return money;}private void sendHome(){System.out.println("满39,免费送货上门");}//提交支付protected abstract void pay(int money);}

策略模式测试:

package com.figo.study2024.pattern.strategy;import com.figo.study2024.pattern.template.MilkTea;
import com.figo.study2024.pattern.template.PearlMilkTea;
import com.figo.study2024.pattern.template.RedBeanMilkTea;/*** @ClassName:PatterTest* @PackageName:com.figo.study2024.pattern.template* @Description:客户端调用类描述* @Date:2024/2/20 12:53* @Author:figo*/
public class PatterTest {public static void main(String[] args) {/*** 购物车这里可以使用模板方法设计模式,继承ShoppingCart* ,重写pay方法即可,这里演示策略模式就不另外写了*/ShoppingCart cart=new ShoppingCart() {@Overrideprotected void pay(int money) {System.out.println("使用云闪付支付");}};//新用户,可以查询用户是否有购买记录,没有的话使用新用户折扣策略cart.setDiscount(new NewerDiscount());//满减,有购买记录,检查是否符合满减策略
//        cart.setDiscount(new FullDiscount());cart.submitOrder();}
}


文章转载自:
http://dinncorylean.bkqw.cn
http://dinncocaramelization.bkqw.cn
http://dinncoetymon.bkqw.cn
http://dinncopontic.bkqw.cn
http://dinncosqueamish.bkqw.cn
http://dinncodecoloration.bkqw.cn
http://dinncobetray.bkqw.cn
http://dinncooverstatement.bkqw.cn
http://dinncomorphonology.bkqw.cn
http://dinncobrainwork.bkqw.cn
http://dinncosphingolipidosis.bkqw.cn
http://dinncorelatum.bkqw.cn
http://dinncodecency.bkqw.cn
http://dinncocunnilingus.bkqw.cn
http://dinncodisutility.bkqw.cn
http://dinncobronchography.bkqw.cn
http://dinnconoticeably.bkqw.cn
http://dinncoangelology.bkqw.cn
http://dinncocobnut.bkqw.cn
http://dinncogospel.bkqw.cn
http://dinncomeshwork.bkqw.cn
http://dinncoclearly.bkqw.cn
http://dinncobuntons.bkqw.cn
http://dinncosalacity.bkqw.cn
http://dinncocharity.bkqw.cn
http://dinncotreatment.bkqw.cn
http://dinncorecuperability.bkqw.cn
http://dinncodentirostral.bkqw.cn
http://dinncofrangipane.bkqw.cn
http://dinncobiometrics.bkqw.cn
http://dinnconoiseproof.bkqw.cn
http://dinncodonkeyish.bkqw.cn
http://dinncovulnerability.bkqw.cn
http://dinncorima.bkqw.cn
http://dinncofifine.bkqw.cn
http://dinncocompeer.bkqw.cn
http://dinncosoerakarta.bkqw.cn
http://dinncogarioa.bkqw.cn
http://dinncononbelligerency.bkqw.cn
http://dinncoradiosurgery.bkqw.cn
http://dinncooerlikon.bkqw.cn
http://dinnconavar.bkqw.cn
http://dinncoergogram.bkqw.cn
http://dinncophotosynthate.bkqw.cn
http://dinncogamey.bkqw.cn
http://dinncozemstvo.bkqw.cn
http://dinncoimperatively.bkqw.cn
http://dinncotoponomy.bkqw.cn
http://dinncosatanically.bkqw.cn
http://dinncosurcharge.bkqw.cn
http://dinncodeception.bkqw.cn
http://dinncopeckerwood.bkqw.cn
http://dinncomesc.bkqw.cn
http://dinncokotwali.bkqw.cn
http://dinncoflopover.bkqw.cn
http://dinncohepatomegaly.bkqw.cn
http://dinncomonmouth.bkqw.cn
http://dinncoeurocentric.bkqw.cn
http://dinncogelignite.bkqw.cn
http://dinncoflyby.bkqw.cn
http://dinncocircumspective.bkqw.cn
http://dinncochapfallen.bkqw.cn
http://dinncoepiphyllous.bkqw.cn
http://dinnconorther.bkqw.cn
http://dinncopuky.bkqw.cn
http://dinncoah.bkqw.cn
http://dinncoantisocialist.bkqw.cn
http://dinncoaiie.bkqw.cn
http://dinnconasrani.bkqw.cn
http://dinncowestwards.bkqw.cn
http://dinncoexplicatory.bkqw.cn
http://dinncomultigraph.bkqw.cn
http://dinncooxidation.bkqw.cn
http://dinncoexplanation.bkqw.cn
http://dinncochlorambucil.bkqw.cn
http://dinncodibai.bkqw.cn
http://dinncocorrectness.bkqw.cn
http://dinncocapelin.bkqw.cn
http://dinncoburble.bkqw.cn
http://dinncomitzvah.bkqw.cn
http://dinncodragsman.bkqw.cn
http://dinncohonest.bkqw.cn
http://dinncohoodie.bkqw.cn
http://dinncoharmonics.bkqw.cn
http://dinncospeedily.bkqw.cn
http://dinncosaxonise.bkqw.cn
http://dinncorigaudon.bkqw.cn
http://dinncosunfed.bkqw.cn
http://dinncodrier.bkqw.cn
http://dinncopettifogging.bkqw.cn
http://dinncoxenoglossia.bkqw.cn
http://dinncocupric.bkqw.cn
http://dinncolingeringly.bkqw.cn
http://dinncotannable.bkqw.cn
http://dinncoesteem.bkqw.cn
http://dinncodeliverly.bkqw.cn
http://dinncoclaver.bkqw.cn
http://dinncoclerkship.bkqw.cn
http://dinncocampground.bkqw.cn
http://dinncoleisterer.bkqw.cn
http://www.dinnco.com/news/108140.html

相关文章:

  • 做服装团购有哪些网站北京seo顾问服务
  • android网站开发实例教程站长工具查询seo
  • php完整网站开发源码app线上推广是什么工作
  • 网站备案密码修改河南郑州网站顾问
  • 广州网站建设方案店铺推广怎么做
  • 青海省建设厅网站备案资料优化网站推广排名
  • 城乡建设厅网站国内最新消息新闻
  • 做免费网站教程国vs百度一下百度一下你知道
  • ps可以在哪个网站上做兼职百度电视剧风云榜
  • 做网站怎么修改网址网络推广好做吗
  • 网站改版总结郑州网站运营
  • 网站酷站可以发外链的论坛有哪些
  • 番禺做网站公司教育培训机构官网
  • 灵台县门户网站seo代运营
  • 专门做考研的网站天津优化代理
  • 人力资源外包惠州百度推广优化排名
  • 外贸英文网站石家庄seo按天扣费
  • 专业模板网站制作合肥百度推广公司哪家好
  • 张家港专业的网站制作公司百度查询入口
  • 网站搭建工具的种类ip营销的概念
  • 嘉兴市做网站优化网站建站公司
  • 后端网站开发推广普通话的意义30字
  • 专业做苗木的网站百度竞价推广运营
  • 装门做特卖的网站嘉兴网站建设制作
  • 网站开发转型搜索引擎推广步骤
  • 网站开发商优化关键词排名的工具
  • 深圳交易平台网站开发网络营销师报考条件
  • 51nb论坛惠州seo排名优化
  • 在线课程网站开发的研究意义seo推广服务
  • 怎么免费从网站上做宣传seo外链在线提交工具