首页
登录
从业资格
阅读下列说明和java代码,将应填入 (n) 处的字句写在答题纸的对应栏内。
阅读下列说明和java代码,将应填入 (n) 处的字句写在答题纸的对应栏内。
免费题库
2022-08-02
15
问题
阅读下列说明和java代码,将应填入 (n) 处的字句写在答题纸的对应栏内。【说明】 某发票(lnvoice)由抬头(Head)部分、正文部分和脚注(Foot)部分构成。现采用装饰(Decorator)模式实现打印发票的功能,得到如图6-1所示的类图。
【java代码】class invoice{public void printInvoice( ){ System.out.println ( "This is the content of the invoice!"); }}class Decorator extends Invoice { protected Invoice ticket; public Decorator(lnvoice t){ ticket = t;} publicvoid printInvoice( ){ if(ticket != null) (1) ; } }class HeadDecorator extends Decorator{ public HeadDecorator(lnvoice t){ super(t);} public void printInvoice ( ){ Systent.out.println( "This is the header of the invoice! "); (2) ; }} class FootDecorator extends Decorator { public FootDecorator(Invoice t){ super(t);} public void printlnvoice( ){ ( 3) ; Systent.out.println( "This is the footnote of the invoice! "); }}Class test { public static void main(String[] args){ Invoice t =new Invioce( ); Invoice ticket; ticket= (4) ; ticket.printInvoice( ); Systent.out.println(“------------------“); ticket= (5) ; ticket.printInvoice( ); }}程序的输出结果为: This is the header of the invoice! This is the content of the invoice! This is the footnote of the invoice! ---------------------------- This is the header of the invoice! This is the footnote of the invoice!
选项
答案
解析
(1) ticket.printInvoice()
(2) ticket.printInvoice()
(3) ticket.printInvoice()
(4) new FootDecorator(new
转载请注明原文地址:https://tihaiku.com/congyezige/2407733.html
本试题收录于:
中级 软件设计师题库软件水平考试初中高级分类
中级 软件设计师
软件水平考试初中高级
相关试题推荐
( )是蠕虫病毒。A.熊猫烧香 B.红色代码 C.冰河 D.爱虫病毒
软件测试的对象包括( )。 ①软件代码使②文档③数据A.①②
传统编译器进行词法分析、语法分析、代码生成等步骤的处理时,前一阶段处理的输出是后
传统编译器进行词法分析、语法分析、代码生成等步骤的处理时,前一阶段处理的输出是后
软件测试的对象不包括()。A.一段功能的实现代码 B.概要设计说明书 C.
软件测试的对象不包括()。A.软件代码 B.软件文档 C.质量保证方法
()属于系统软件,它直接执行高级语言源程序或与源程序等价的某种中间代码。A.
关于软件测试的说法,()是不正确的。A.代码审查是代码检查的一种,是由
软件测试的对象不包括()A.软件代码 B.软件开发过程 C.文档 D.数
以下属于静态测试方法的是_____。A.代码审查 B.判定覆盖 C.路径覆盖
随机试题
FormanyyearsafterheformedhisTheoryofRelativity,AlbertEinsteinvis
[originaltext]M:Weseemtobehavingthisconversationoverandoveragain.W:
资本主义新闻自由的底线是不能()A.批评政府 B.揭露政要丑行 C.否定资
建设工程项目投资决策完成后,控制工程造价的关键在于()。A:工程设计 B:工
肺痨的病程发展演变中,易受损的脏腑是( )。A.肺、脾、肾 B.肺、心、肾
下列证候除哪项外,均可由失血引起A.亡阴 B.亡阳 C.肝风内动 D.血虚
关于多巴胺和去甲肾上腺素的叙述,错误的是A.都是儿茶酚胺类药物B.都有心脏兴奋作
《医疗机构药事管理规定》的发布部门是A.国家发展与改革委员会 B.卫生部、国家
124.《国家电网公司基层党支部工作规则(试行)》规定,外出执行临 时性任务、
某投资者拟以500万元的限额购买店铺,现有销售总价分别为500万元、200万元、
最新回复
(
0
)