首页
登录
从业资格
阅读下列说明和java代码,将应填入 (n) 处的字句写在答题纸的对应栏内。
阅读下列说明和java代码,将应填入 (n) 处的字句写在答题纸的对应栏内。
免费题库
2022-08-02
13
问题
阅读下列说明和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.路径覆盖
随机试题
Treesaresocommonaridquietthatwepaythemlittlemind.What,forinsta
Therearemorethan300millionofusintheUnitedStates,andsometimesit
Please___________(不要忘记记你姐姐到超市买一些牛排).don’tforgettoaskyoureldersistertob
[originaltext]ThenotoriousYasukuniShrineinTokyoonSaturdaymadefallac
Manydogownersregardtheirfurryfriendsastheirchildren,andtalktoth
Shewas(promotion)______frommajortocaptain.promoted她从少校被提升为上校。本题考查被动语态的用法。
内服能涌吐风痰,外用能收湿、去腐的药物是A.胆矾 B.明矾 C.皂矾 D.
目前我国上海期货交易所规定的交易指令主要是()。A.套利指令 B.止损指令
山坡陡峭的路段不宜采用()。2014年A.柱板式锚杆挡土墙 B.加筋土挡土墙
关于肾盂肾炎的治疗原则,哪项不正确A.多饮水 B.停药后每月复查尿常规并做尿培
最新回复
(
0
)