锘??xml version="1.0" encoding="utf-8" standalone="yes"?>久久免费视频1,欧美日韩最好看的视频,欧美电影一二区 http://www.aygfsteel.com/simonshen/category/48249.htmlzh-cn Thu, 07 Apr 2011 16:33:19 GMT Thu, 07 Apr 2011 16:33:19 GMT 60 瑙傚療鑰呮ā寮?/title> http://www.aygfsteel.com/simonshen/archive/2011/04/07/347745.htmlsimon.shen simon.shen Thu, 07 Apr 2011 14:29:00 GMT http://www.aygfsteel.com/simonshen/archive/2011/04/07/347745.html http://www.aygfsteel.com/simonshen/comments/347745.html http://www.aygfsteel.com/simonshen/archive/2011/04/07/347745.html#Feedback 0 http://www.aygfsteel.com/simonshen/comments/commentRss/347745.html http://www.aygfsteel.com/simonshen/services/trackbacks/347745.html 闃呰鍏ㄦ枃 ]]> 絳栫暐妯″紡 http://www.aygfsteel.com/simonshen/archive/2011/04/06/347744.htmlsimon.shen simon.shen Wed, 06 Apr 2011 14:56:00 GMT http://www.aygfsteel.com/simonshen/archive/2011/04/06/347744.html http://www.aygfsteel.com/simonshen/comments/347744.html http://www.aygfsteel.com/simonshen/archive/2011/04/06/347744.html#Feedback 0 http://www.aygfsteel.com/simonshen/comments/commentRss/347744.html http://www.aygfsteel.com/simonshen/services/trackbacks/347744.html 浠庝粖澶╁紑濮嬶紝鎶婂父鐢ㄧ殑璁捐妯″紡閮界畝鍗曠殑鏁寸悊涓閬嶏紝甯屾湜姣忎釜鏄熸湡鑳借嚦灝戞暣鐞?涓ā寮忓惂錛屽厛浠庣畝鍗曠殑絳栫暐妯″紡寮濮嬨?br />
姒傚康錛?/strong>瀹冨畾涔変簡涓緋誨垪鐨勭畻娉曪紝騫跺皢姣忎竴涓畻娉曞皝瑁呰搗鏉ワ紝鑰屼笖浣垮畠浠繕鍙互鐩鎬簰鏇挎崲銆傜瓥鐣ユā寮忚綆楁硶鐨勫彉鍖栦笉浼氬獎鍝嶅埌浣跨敤綆楁硶鐨勫鎴楓?br />
絳栫暐妯″紡寰堢畝鍗曪紝瀹為檯涓婂氨鏄疧O涓殑澶氭侊紝涓句釜渚嬪瓙錛屾煇鍟嗗満瑕佽繘琛屼績閿錛屽浜庢櫘閫氶【瀹㈡墦88鎶橈紝瀵逛簬閾跺崱瀹㈡埛鍦?8鎶樺熀紜涓婂啀婊?00鍑?60錛屽浜庨噾鍗″鎴峰湪88鎶樺熀紜涓婂啀婊?00鍑?00銆?br />
UML鍥懼涓嬫墍紺猴細
鎺ュ彛DiscountStrategy浠g爜濡備笅錛?br />
public interface DiscountStrategy {
public double discount( double sum);
}
綾籊eneralDiscountStrategy綾諱唬鐮佸涓嬶細
public class GeneralDiscountStrategy implements DiscountStrategy {
@Override
public double discount( double sum) {
return sum * 0.88 ;
}
}
綾籗ilverDiscountStrategy綾諱唬鐮佸涓嬶細
public class SilverDiscountStrategy implements DiscountStrategy {
@Override
public double discount( double sum) {
sum = sum * 0.88 ;
int t = ( int ) sum / 400 ;
sum = sum - t * 16 0 ;
return sum;
}
}
綾籊oldenDiscountStrategy浠g爜濡備笅錛?br />
public class GoldenDiscountStrategy implements DiscountStrategy {
@Override
public double discount( double sum) {
sum = sum * 0.88 ;
int t = ( int ) sum / 400 ;
sum = sum - t * 200 ;
return sum;
}
}
綾籆ashier浠g爜濡備笅錛?br />
public class Cashier {
private DiscountStrategy discountStrategy = new GeneralDiscountStrategy();
public void getDiscountStrategy(CustomerLevel customerLevel) {
switch (customerLevel) {
case GENERAL:
discountStrategy = new GeneralDiscountStrategy();
break ;
case SILVER:
discountStrategy = new SilverDiscountStrategy();
break ;
case GOLDEN:
discountStrategy = new GeneralDiscountStrategy();
break ;
}
}
public double calculate( double price, int num) {
return discountStrategy.discount(price * num);
}
}
]]>
主站蜘蛛池模板:
台南市 |
西安市 |
定西市 |
黄山市 |
武川县 |
凌云县 |
邢台县 |
深水埗区 |
徐闻县 |
许昌市 |
浦北县 |
太湖县 |
雅江县 |
巴彦淖尔市 |
旅游 |
扎鲁特旗 |
宜昌市 |
天台县 |
湖口县 |
镇江市 |
义乌市 |
慈利县 |
县级市 |
贵阳市 |
西平县 |
永康市 |
沙雅县 |
巫山县 |
神池县 |
民丰县 |
乳山市 |
乌拉特中旗 |
峨边 |
禹州市 |
清原 |
神农架林区 |
万荣县 |
长汀县 |
望城县 |
玉溪市 |
临夏市 |