2012-2013(一)ssd3考试试卷A.docx

上传人:王** 文档编号:1002815 上传时间:2024-03-15 格式:DOCX 页数:10 大小:73.26KB
下载 相关 举报
2012-2013(一)ssd3考试试卷A.docx_第1页
第1页 / 共10页
2012-2013(一)ssd3考试试卷A.docx_第2页
第2页 / 共10页
2012-2013(一)ssd3考试试卷A.docx_第3页
第3页 / 共10页
2012-2013(一)ssd3考试试卷A.docx_第4页
第4页 / 共10页
2012-2013(一)ssd3考试试卷A.docx_第5页
第5页 / 共10页
2012-2013(一)ssd3考试试卷A.docx_第6页
第6页 / 共10页
2012-2013(一)ssd3考试试卷A.docx_第7页
第7页 / 共10页
2012-2013(一)ssd3考试试卷A.docx_第8页
第8页 / 共10页
2012-2013(一)ssd3考试试卷A.docx_第9页
第9页 / 共10页
2012-2013(一)ssd3考试试卷A.docx_第10页
第10页 / 共10页
亲,该文档总共10页,全部预览完了,如果喜欢就下载吧!
资源描述

《2012-2013(一)ssd3考试试卷A.docx》由会员分享,可在线阅读,更多相关《2012-2013(一)ssd3考试试卷A.docx(10页珍藏版)》请在优知文库上搜索。

1、总分四五东北大学考试试卷(A卷)20122013学年第一学期课程名称:面向对象程序设计II!.SingleChoice(20POilItS2pointseach)1Fromwithinachildclass,itsparentclassisreferredtoviathekeyword?(C)(八)(his(B)Base(C)Super(D)parent2ClassesfromwhichofthefollowingpackagesareimplicitlyimportedintoeveryJavaprogram?(A)(八)java.Iang(B)java.util(C)java.awt(D)

2、java.io3InJava,thedefaultlayout布局managerforaJPaneIcomponentis(D)(八)BorderLayout(B)GridLayout(C)GridBagLayout(D)FIowLayout4TheStrategy策略designpattern模式islikelytobeusefulwhenimplementingwhichofthefollowing?(B)1Anapplicationthatoffersseveralalternate交替sorting排J至algorithms算法IlAsimpleclasstostoretheaddre

3、ssofanorganizationofwhichonlyoneinstancecanbeinstantiated(八)None(B)1only(C)IIonly(D)1andIl5IfthelengthofaparticulararrayisthevalueofLIMIT,whatistheindex指针ofthelastiteminthatarray?(D)(八)LIMIT(B)O(C)LIMIT/2(D)LIMIT-I8Ifafileopenedforreadingdocsnotexist,whichofthefollowingeventswilloccurinJava?(D)(A) A

4、NulipoinierExcepiionwillberaised.(B) Anewfilewillbecreated(C) Arun-timeerrorwilloccur(D) AFilcNotFoundExccptionwillberaised.9Adesignpatternistypicallyusedlo(D)(A) allowtheuseofobject-orientatedconceptsinalanguagethatisnotobject-oriented(B) reducethenumberofclassesinthedesignofaprogram(C) ensurethatc

5、odeexecutesatoptimalspeedduringntimc(D) describeapracticalsolutiontoaCOmmOndesignproblem10Whichofthefollowingstatementsis(are)teinJava?(B)IClassesthatcontainabstractmethodsmustbedeclaredabstract.IIClassesthatcontainprotectedmethodsmustbedeclaredabslct.(八)1andIl(B)Ionly(C)IIonly(D)NoneH. Fill in blan

6、ks. (10 points* 1 point each )6 Whichofthefollowingstatementsisnottrueofleclassjava.util.ArrayList?(B)(A) AninstanceofArrayListcangrowtoaccommodatenewitemswhenthecollectionisfull.(B) Onceanobjectisinsertedinto插入aninstance实例OfArrayList.itcanneverberemoved.(C) ItemsstoredbyaninstanceofArrayListcanbeac

7、cessedusingintegerindexes.(D) TheconstructoroftheAayListclass,whencalledwithnoarguments,causesanemptyArrayListtobeconstructed.7 ACOneCtiOn聚集IyPiCanymOdekarelationship?(C)(八)many-(o-many(B)zcro-(o-onc(C)one-to-many(D)one-to-one1 A单例designpatternCansuretomakeonlyoneobjectinthesoftwaresystem.2 InaUMLcl

8、assdiagramsrepresentationofaclass,(hetop.middle,andlowerrectangularcompartmentsrespectivelydescribethe类名称.属性and方法oftheclass.3 Inanobjectmodel,thedatathatanobjectisresponsibleformaintainingarcrepresented描写by届性.4 Thedatainainterfacemustbe共有的and抽象的.5 封装,继承and多态arcthebasecharactersofObject-OrientedProgr

9、amming.publicinterfaceMemberStrategypublicdoublecalcPrice(doublebooksPrice);publicclassPriceprivateMemberStrategystrategy;publicPrice(MemberStrategystrategy)this.strategy=strategy;)publicdoublequote(doublebooksPrice)returnthis.strategy.calcPrice(bksPrice);)publicclassNonnalMeniberStrategyimplementsM

10、emberStrategypublicdoublecalcPrice(doublebooksPrice)SySlem.oulprinlln(对于初级会员的没有折扣);returnbooksPrice;)publicclassVIPMemberStrategyimplementsMemberStrategypublicdoublecalcPrice(doublebooksPrice)SySIem.oulprinlln(对于中级会员的折扣为10%);returnbooksPrice*0.9;)publicclassSuperMemberStrategyimplementsMemberStrateg

11、ypublicdoublecalcPrice(doublebooksPrice)SySlem.oulprinln(对于高级会员的折扣为20%);returnbooksPrice*0.8;)(f)III. DesignasimpleBookSellerSystemwithstrategypattern.(25points)(a) Youdontcareallthefunctionsofthesystem.(b) TherearethreekindsofclientwhichincludeVIPMember(0.9*price).NorniaIMemberf1eprice),SuperMember

12、(0.8*price).Theyhavethedifferentdiscountwhentheybuybookfromthesystem.Youmustusestrategypatternwhenyoudesignthesystem.Firstly,youshouldgive(heUMLclassdiagramiththestrategypattern策略模式.(5points)Secondly,youshouldwritethecodeforeachclassyoudesignintheUML.(15points)Thirdly,youshouldwriteaclassnamedTestwh

13、ichincludeamain()method,wesupporttherearethreeclientsnamedTom(VIPMember),John(NormaIMember)andMike(SuperMember).Theclassyouwritecansellabooktothethreeclients.Wesupportthepriceofthebookis150.(5points)YourUMLishere.第3题答案:UML图(5points)IV. CreateanStudentinformationManagementapplicationasshownFig.1using

14、SwingGUI.Partoftheworkhasbeendone.Youshouldfinishthecode.(30points)Fig1StudentInfornwtionMHnagenIenlApplicationimportjava.aw.4;importjava.aw(.event.ActionListener;importjava.aw(.event.ActionEvent;importjava.io.FilcNotFondExccption;importjava.io.FileOutputStream;inpo11java.io.PriniWriter;importjavax.

15、swing.*;*Demonstratesthecomponent(glinkJTcxtFicId).Thisclassextendsclass(linkJPanel).*/publicclassStudentManagcnwntextendsJPaneIprivateJLabeIIabelName:privateJLabcIIabcINo;privateJLabeIIabeIGender:PriVaIeJlexiFieIdIextFieIdName;privateJTextFieIdIextFieIdNo;privateJTextFieldIextFieidGender:JButtonUddSIudentBUtton;JButtonsbmitButton;publicstaticvoidmain(Stringargs)JFrameframe=newJFramec学生信息增):frame.setContentPane(newStude

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 办公文档 > 工作计划

copyright@ 2008-2023 yzwku网站版权所有

经营许可证编号:宁ICP备2022001189号-2

本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!