使用桥接模式实现画笔实例,其中一个颜色具体实现类如下:public class Green implements Color{public void bepaint(String penType,String name){System.out.println(penType + "绿色的"+ name + ".");}}根据以上代码补全以下空白处。抽象类:public abstract class Pen{protected _______ color;public void setColor(Color color){___________=color;}public abstract void draw(String name);}扩充抽象类代码:public class BigPen ____________{public void draw(String name){String penType="大号毛笔绘制";this.color._________(penType,name);}}假设该系统需要修改为支持5种毛笔型号,12种不同颜色,不考虑客户端Client,采用桥接模式则者少需要设计____________个类。
组合模式:(水果盘模式)补全容器构建代码public class Plate ____(1)_____ MyElement{private ArrayList list= ____(2)_____;public void add(MyElement element){list.____(3)_____(element);}public void delete(MyElement element){list.____(4)_____(element);}public void eat(){for(Object object:list){( ____(5)_____ ).eat();}}}
某公司欲开发一套手机来电提示程序,在最简单的版本中,手机在接收到来电时会发出声音来提醒用户;在振动版本中,除了声音外,在来电时手机还能产生振动;在更高级的版本中手机不仅能够发声和产生振动,而且还会有灯光闪烁提示。采用装饰设计模式来设计。补全以下代码实现。抽象构件:abstract classCellphone{public abstract void receiveCall();}具体构件:class SimplePhone extendsCellphone{public void receiveCall(){System.out.println("声音提示");}}抽象装饰:class PhoneDecorator extendsCellphone{private _____(1)______ phone=null;public PhoneDecorator(Cellphone phone){if(phone!=null){_____(2)______;}else{this.phone=new SimplePhone();}}public void receiveCall(){_____(3)______.receiveCall();}}具体装饰:class JarPhone extends PhoneDecorator{public JarPhone(Cellphone phone){__________(4)__________;}public void receiveCall(){_____(5)______.receiveCall();System.out.println("振动提示");}}
下列关于企业从银行提取现金或把现金存入银行的经济业务,一般( )。
A. 只填制付款凭证,不填制收款凭证
B. 只填制收款凭证,不填制付款凭证
C. 既填制付款凭证,又填制收款凭证
D. 填制付款凭证或填制收款凭证