标签:源代码 charge public amount return
public class CheckWord { public final int basicAmount=85; String advertisement; int amount; public CheckWord(String advertisement){ this.advertisement=advertisement; } public void setChargeAmount(){ amount=advertisement.length()+basicAmount; } public int getAmount(){ return amount; } } public class Charge { public final int basicCharge=12; CheckWord checkWord; Charge(CheckWord checkWord){ this.checkWord=checkWord; } public void giveCharge(){ int charge=checkWord.getAmount()+basicCharge; System.out.println("广告费用:"+charge+"元"); } }
public class TypeSeting {
String advertisement;
public TypeSeting(String advertisement){
this.advertisement=advertisement;
}
public void typeSeting(){
System.out.println("广告排版模式:");
System.out.println("********");
System.out.println(advertisement);
System.out.println("********");
}
}
public class ClientServerFacade {
private CheckWord checkWord;
private Charge charge;
private TypeSeting typeSeting;
String advertisement;
public ClientServerFacade(String advertisement){
this.advertisement=advertisement;
checkWord=new CheckWord(advertisement);
charge=new Charge(checkWord);
typeSeting=new TypeSeting(advertisement);
}
public void doAdvertisement(){
checkWord.setChargeAmount();
charge.giveCharge();
typeSeting.typeSeting();
}
}
public class Application {
public static void main(String[] args) {
ClientServerFacade clientServerFacade;
String clinetAdvertisement="月光电脑,价格6356元,联系电话:1234567";
clientServerFacade = new ClientServerFacade(clinetAdvertisement);
clientServerFacade.doAdvertisement();
}
}
本文出自 “技术的秘密-刘聪聪的创作” 博客,请务必保留此出处http://liucongcong.blog.51cto.com/11527480/1826006
标签:源代码 charge public amount return
原文地址:http://liucongcong.blog.51cto.com/11527480/1826006