《江苏开放大学本科计算机科学与技术专业060219JAVA程序设计△期末试卷.docx》由会员分享,可在线阅读,更多相关《江苏开放大学本科计算机科学与技术专业060219JAVA程序设计△期末试卷.docx(71页珍藏版)》请在课桌文档上搜索。
1、I.在Ma语言中,(解)是幽林的元更2.下排衣晡(右衿命名撤冲,正鼬提(常购部烟).1切a期阳遨祥且树瞰住网(clais).4 .GZile陋懒4触梆树谕眇K妫1卜5 .晌6ile(!e);忡您ft!e第行(V).6 关FMTP三4三三(定义ttjm).7 .在S语各礼恤胸犍阳将AM?(.aI迎).&定妙5M辕地的曲公(P11Xted).9.卜潮性都茄桃,IIW1(语杯妍娘版).IQ在如中,(IWp).晦矶阙三勤般氓/南报设有例S3淀义邨让inia11=(I.13):顺帏6幽粒播鼬足a虢阮蝌卜标为15).U,F峨干方法的帆,不正却提三4次义律曲法也可Mili燔硼.崛方法).12下况树1+2+&
2、”+3三(3).13设a、b为IaK里翅,x、F为fll3Jft小为r翔咬8且它眼以韧临MTm研J三提(WltCh(CtrD1*.柳晒愀ti微醍3),注Mile(-!=()15 卜州解体询费是.iMFO,内0:WyX;/;MileGgf16 .区分划哦彷涉犯tM期减势犍和酹.liFytl1.不必鼬今是(if7df鄢O而娜醒IteiUil群族).18 .运行Hfi冏粥.会产生什么异常(AriIhBetiCElDePdg).IXbliCclassEK(pblicstaticvoidmin(Stri%as(intx=0;inty=5:1.ntO2s0.U4);intp=z4:)_19 .定j1.恰f
3、tleWttPI.您吊强好?(JblicfiralstaticdlePl=I14;).20 .在新S中,麻蟠蚊儆恨姗峭韩曲finally刊I烷也21 .为毋类定义力限回三施八帆附送知何以访河谈帅谢诔头就以为(staticndf).22 .僦杼玳玛田E族代妈&1E的文件名(RWm.classAlwidnllxJ10lstancut.friln(,hxllinclassA,);JlPbliCclassBlvoidnnh或0sttcut.ffincln(,hEinclass);)iilicstaticvoidrBin(Stringas)smou1.kinUnGuinOinclass:)及杼Je殿札m
4、理闪断朝(从事向始物崛).2T三4哥十蝴向SW技术(BufferKftJtpJtStnOT.隔侬不通的(ftetract和fi政州雕保).*、当电微椀她就MMMWfrS(取而It).27JPirel御而聆理勒(FI阑邓Ut.M好照的缴,下班献中技国的收(粕蔺崛触网由触蝇匕力门定训网.叽随阚例潮渤?(&pUe.皴Xf奥31,下联琢粼Filc獭魁书哂峨(File寿11W奴憎麻.IfnniJiB千(百位心的渣土i赖;-m/3Wld砌拗11薮件氐会产生(D)的儆件?扪4名处(3个字抑蚊伟打军名为UaSS)?&以下腿跳嫣M1.含坳是(*dledDouble.WV三;)7.下颁网,布于JHw炼C胞的一睢(
5、.Rvacsiing).&撵厢蹴弹副廊M:件(A1.dies、Aldass和KChBS文件)?Fi琳打防三敏加MX命令?/./)11.下面(雌行醐!就的默(tnje)P1.bIiCclassHPlWiCstaticvoidIBin(StringuargsIM=M0;Ifo=aa:SysIeftout.Hindnfth.equals);classJ(inti=1(0;K下,献阚曲献(3).intx=ktfile(-x!=y)()17.ilFm三itch)CastOiSyst(cw.printIn(*(xndition(T):cselst(xtprintInCCaxIition:0(2tst(no
6、utPrintlnCtkndition2);CaseikMsteicutrintlnCCditiofiJ);bnk:kilt:Systmutprintln(,ftheCotion*):)当nl三C0.I.2,3)i,ftaQaiition3l&Maini受阴阀fc相窗tI.!HIif(ttw)l)胎渊利精即19.下,福的双怖?掷话颇难到淡除渊?(priwe)21.给出Tffi的书H弼:PiblicclassMI3(privatefloata;plicstaticvoidn()28Mft:麻被玳电矶个为境物三M似Clg独我帆网30m:悔炯则谢,格三僦第咫1.fiiympdIicclassSmMI
7、iCstaticvoidron(Stringirs)(dcd)leSiIl=Q0:tor(iri三1;ilicstaticw)dmin(Strirlesun=(1.0:far(inti=l:i=100;i*+)沏*=i,i;st-acut.prindn(sufW;)辎渺做,毅:釉羽雕到K的恸和.工期姒丽PMicclassSuiPIbIicstaticvoidrainKtringagsl)(doublesun=(10;tr(inti三1;i=*Asm);)蝌院翻她跳.滕imlIitI(I)IfiiAKiMJiffi.4.WTS泌IiCclassSmPlbIiCstaticvoidmin(Stri
8、ngags(lcsiti=(10;tor(inti三;i=lC0;i11)sun*三1.0/痴h】i;stji.ftinclna11=*-i;)脚皖蜥助跳答宪耀IUM3,WlOO的值相仰8出工触姒球加IrlSiTR1.ia;P1.bIiCClassTestl(PiblicstaticvoidIBinGlri同ms)Iinti,s=0:into三(24,6&1。,12.N,%18);for(i=0:iaIegth:ih)if(a(iV30)Sroi:SySmout.frintlns=*);)ifrS二36.&新姒Tmirxrt切a,i;b!icclasssix(PlbliCsuticvoidai
9、nStrinargsD(ABs=MAMat!*.*l;nJSOlkr*);S),stenout.prindns.t6trig();)claIStringsi;Strings2;PibliCABtStrincstr,Stri咏strt)(si=strl;血=stt2:)MicStriret6trijng()(returnsi+公)运阳乐Great!ImJSU1.er7.imwiqx11、说ai*;jblicclassic(PIbliCstaticvoidIBin(Stringas)ISSC13jwSW&tCI(10.2(1.):bj.sk0:!)claSUlwC屣intb;S)CTCass(i1
10、1tM11t)Ihb;HclassSubClefisextxisSt(叫er(,);C=B;HclassSuISdflassexterfeSitClassIinta:Sd&Klc5(int,in)Systmout.criMln三*a%护bfc):)1ihf一tf=flb=3)=3).&下,冏胭谈呆知泌IiCclassClaIinta=U,2,i5J;voidoutO(tor(intj=0:ja.lth:j+)Sy$10art.k旅(aJ一?;)(IbhC$xaiicidmin(StrineOw(Class11y=gfIassO;rw.xrt0;)械m59.刚以T三写IH肺结为fclicclas
11、sIoFriVatefltwit;privatestaticStrineE;PibliCvoidseteicfl(Btwight)加哂加=wvt;)privatewidwtstn,cut.printlnnp*ftJwit9f1;)PdMiCstaticvoidBBin(SlringOangs)(TEnl?溪!苗:Tcoat=Ig7t0;Ca1.SetAei由I(20);cat.oR0;)_答黑:领制泾31D斤Ift网速以刖汽轴揖拒施pblicclas&Sui(PIbliCstaticvoidainIIk(JMesun=0.0;for(irrti-1;il100;i11)sa1.O/JIicst
12、aticvoidminSiriigargsJMrir.tf.x=:if(x,A1)lJF:度;)dse(尸筷:二案:)Swmout.gnUn(中丁用:)答黑你快乐风s三1.赠解,从侬U的他氏瞰GH算华邮及F的值微出J滕公式如下:F(95)i11(tJirri1.ia”:PiblicClassS34(plicstaticXndmm(StringOargsthrc5KtnxIXlm(IrpHSmwifeaiHisr=newIr1t*三2r(Systfiin);BufferoifcxbrbrButYerrdfeaier(isrh(kuNeCtF:StRStr;str=br.gil.ineO;CDwb
13、le,rsftble(str);R(9/5)C*32;,stcut.println(*FQ:112,定义Z为M底虢.期也便介整诫员:BtEr三11ute.秒Ei为M渊蝴淞性这三M激翅应苻明为移方,为即Tim类定义械而拟方便遴对娴初献成员超1.再定义dEl邮方制榔报席由抑峡.为Mirr关停MI以下方法,ak(rrf(intsec)、aNirute(inl11in)、MdhriMbM、sdex11l(intsec).SI蛾川MHintjIin)、SlHMMjrnhxi)分别审I、分、制行ifcTPdeDew:plicclassWMIXiVateinthour,imte.seard;folicTim
14、(int销胡中hr.intIinrtGiMscxw(ser();ElW=tour;EniM?=aifute;W洸OXri三wtxd;hlicxid岫SaXwKirrtsec);sectniksec;JFddiCvoidadfllifwte(imnin)nirteKnn:)pdlicvoidaWkurlicvoiddiaplay(systefi*.piMInOnr*fei11ute分*SeErf*t):)I1繇;3送面2期咆雒K恸师限粗毗包部剧法以妞槌K性肺懦附法胞泻力学生类SWdmtWnn类,和I咆含字号雕,包含艇施Wi显示学号的方法最后*楼限Em包含加加)方法在einO脸两口生,!和过用雒丽
15、既麻田的沟、姓名、住制燃眼.件hm.aPitbgc叭。*.Enxc;俄研 PtTM类 Ethor 傩pliclmI.pdlicint刎Ao(return瞅;)pdlicvoid9ete(intage)I*,他:椒;PIbIiCStringgt)erelumrw;)Mic叩idMWKtrirtgrw),l*.r=re;1,Pd)IieSVri电啰tSCoIreturnsex:)blicvoidSetSWC(Slri%sex)*.sexsex:Xft2:*.jipare町皿*,rrs;i三* Stdou类* Mnb触dlicclassStkntex(ftnvnprivateStringSUKfen
16、t;blicSunifmO(IpublicSuMtaHStrings(udentfc)IEStuiffltno=StUimM)PIbIiCStrirggptStuntfoOZtUnI$UIkm)11dlicxid洸tSlMt6iri喝siu%)EStuimtno=StUimM:IPIbIiCstaticwidrBin(String;args)(SuIkmsiwStuf11(r20l(09103l;*.setn三C33):ESe晔(21):Suiktiis2wStiKhitO:应SCtsxuiefuno3)10O9l(e3Ul;mwtnjwhEseEseler妁:*,ae(20);/似下麻物踊息
17、*vie*,print11(w,utuktnoO):SySUft*.printIn津UtffKO);Systeft*,Prindn(W*,则SCTO);SySlmmprintIn(*.0):sstfrintl(*.getstudeftnoO);Systm*,mndn*.getnv3E*ctmmai()(circlec1(0).cllicstaticWlidIain(StringagsD(s:nw(*Grt;*,*llwe6clipse.3:S)steftout.friln(s.t(Stnrg():class.IStringsl:StrinRS2;P1.hliCABGtri晔tri.String
18、st2)(si-strl:s2=str2;岫IiCStrirKtlicRid11n0(SySEWt.gMInCfeJI懈.*);Dpblicclasslesti三J(ilicstaticvoidrfiintri11args(BirdbirdnwBirdO:birdnn:Fishfish=nwFishO:fishHnO:K定义m用户夯5Wifswn脚阚、aiiw.脸南那PMt!此三他s研犷锚诙助悻照人.其中用户ID和用户密码时没有缺林而.Wil地址缺省伽指atiilM三pID趾泞申%m3x)1.答案:classuserprivateStringID;privateStnngpassword;pr
19、ivateSuingmail;publicuser()publicusertStringID,Siringpassword.Stringmail)(this.lD三ID;this.password=password;tis.mailmail;publicIJSer(StfingIDfStringpassword)this.lDID;ths.passwordpassword;this.maikID*P;publicStringgetlD()returnID;publicvoidsetlD(StrigID)th.ID=ID;)publicStringJctPasswordOreturnpasswo
20、rd;PUbiiCvoidSet画廊机故,password)(this.passwordpassword;publicStringgetMail()returnPubnC4okjSetMMI(Stramail)(ths.mMmad;publicvoidSbOW(KSystem.out.printl(aVD,、ID);SEemOUtPrintInr该阳户密码*password);SyStem.Outprintlnr该用户email地址为:mail);HpubltcclassUsefDemopublicstaticvoidmal(Strigargs)usera三newu5ef(123S122541
21、54T65698923,94998989859,);a.shw();USefUSef=EUSefr8478674687S6.87486787487Tusef.show():H7.抽出所郁Jwwar三,枷懑r卡(也其跳嗫笆小修F败本先的汕区足4W配敦因为IKltt3U+5帕昉+3帕妨,9Z,答案:publicclasslianxi03publicstaticvoidmain(String11args)itbltb2,b3;foc(int11l;m)(b3三m/1;b2三m%1/10;bl三m%10;iff(b3b3b3b2eb2*b2bleblbl三=m)SyStem.outpntln(m是一个
22、水仙花Jft);)R烯娥1!2!.U!三硝播HifJft:_Gcrat!IIwEclipse.5.3姒卜函trai*;blicclass奴Jiblicstaticvoidmin(Stringargs)Iinti,s三0:i11ta三10,20.30,50,708).90);for(i=0:ialefth;i)if(JiJtt0)s=ai;SysiE.xit.printlniFe);)IiflsUW7.以H0兜嫡峋财:郴?.ClassStnreTestl(blicstaticvoidmin(5tringjargs)(&rirsl=*hellor:SiriretfiwSlringChdkD;ifs
23、l.eas(s2)SySgOU1.iriMlnC福D:elseSystcacut.printIn(TRF):)五、三供16)&钏fMliaulicclaC_3_3Ijl11csmicwidowinKiririsOa11MIhnVSKGoctptiaiIl11SiEMi$r三rwIrputStredfe=IiEr(,stin):ftetvle.HisOxble(str):s=(ab)20:are三feth.sqrt(s*s-a*(s-b)fe-c);Systecut.printInCarea三r2;Oi3Jrw=&D7.打电胸花洸法(要我溜出I。行妍图)14641151010511. 三8)舜福
24、弘嵋淀够伟腿翘骈WWM三I5;告史M=ffeI匏*仲钺ICO峨,(三聊(2)三n三oo缄鼬物年inportjraUti1.Scamer;classBieuilelpublicsutic)id(Bin(SIri鹏口ar)(SFSgout.printCi6,W*);intyr:定端tMf冷为ar”Scanierseiner三rrSctmer(Sysiaiin);yrarsc三ner.rextint0;if(ye3COO)(SvsteBout.rrirrtl11WficfiJi!);SrsteftexitW;)if展(如rtl00!0)e皿4)二价)SySteftOU1.friMmlyeei+“is
25、bissextile):elseS)teout.println(yrar*isrxbiswxti)e*):2. 三fi)三for梆偌应辨9乘法”诀表.M=I12M1*W2*3M9IHMm1=12I=I61&52*5103*5154林30225I幅62=128N8I林212力防防1*7=727=M37=21W=S7=3507=42存7书m2=16於=21件也泌*微E阶56黑用妙18避劈I科洸设45/知刖初M=72烈WIpJlicclassNifBNineIpblicstaticwidIBiMStringUar国ISysmwHkiMbO;forrtj=l:N0;对fr(intk=lj)bre:S)
26、sUut.ritxC*Tsxefiut.frinln:)6.硼幽s三m三11n100抄:出classTestQnoeeIpublicstaticvoidBlin(StrineargsOHint11=2:疝IelrK=KW(IWl即11=Ijw:intkl=2;iklinint;)publicvoidsetftintintjoint)thiftintIbintl=ne*Riimti4);stout.println(%intl:V(*4ftli11tl.*4bintJ.*);MntMttS=Foifit1.eetFbintO:SySMcut.trinel11fint2:Vfii11t2.*4bin
27、l2*);lintMnt3=r*Rnnt(:ft)i11tl.setlbi11t(Rinirt1*CinU.x*Hint1.*D;)9.三8)器写一惜生类&gK,要求:(1)-StukmK三:id:1小怙代怒羯M:String我通代翻名咏:int必代爵热:toolm里,f渤捌(X:tme标男.fa&标妇皿:Strm翔松代姆系电话物换SluM幽藤在a岫Me久itSirirn,itua,hxlavs,l11P):fiuifi敢,形豺?I咐黎战分捌觥学出姓名、懵、件必瀛系电话源geteO:疑斛难协法懒鼬koletSex()0:喇捌作阴湎闷脸熨ImX):飘麻蛆作为桢撷抽隹JxblicSuirujotr
28、in():以姓繇电话的盼昨为懒阚把classSUlfefltIlongid:Stri%e;1.M峡;bleansei:k(me;SudOTt(Icrgi.Stringn.inta.Iwolems.lrgP)i三F三三(1).国锄三!4hU11加类,胸dlh和hi血jM三ft2fectrk,1砌晒祗恸闹陶股冏长槐曲S5K硼屈匕处密卜愉防哪椭演答先pjblicclassReCtanfk(fIcAtidth,pblicIteCuntk(HaatIrkhhfleetbeid)Ithi1味hh=idh;IhiSki亦=heit;pblicfloatx1.mRthOIretu11(IhiWihhIhiXh
29、dD,2;IpblicfloatjsArraO(retumthi&itidth*this.height:jPlbliCsuticVoidIainStringargs)Rectanglerect=rwRtctafigledQ20):S充mouioiMlnEt:,revt.?(UigthO);Sysxefiout.PriMtnSS*4rect.MgeO):H12版90WA圾即飞JB段7079C级60询D级的戏TFE级irlicsialicXIidmin(Strin(as)1S9Nlout.gnUn桶入个5M:依义默的械为tWI1.械会Tf/dleuj:ScamerMner三r三ScffnerKys
30、tmin);mi*=Semr,Ii?XllhJMeO:。珊七柏ft入蹴ifterklOO)ISySUaaJ1.PrinUnU输入假!);S用EeXi灼;1分肚#A汲,W89沸B圾,79加C热gD希D级.60分以下Eai*if(秘)stajt.tcin=80)Systemout.printlnfthis三isgra(feBf);M次if(m=7WS)rfijt.tinUn11hisrwisC3;elseif(IBAMi)Systemout.printInthisCHHiisgrat式*);elseSta1.outPrinIlnnhiSrwisra,E,*):)施馥i位建顺玩物蝴斓剧就蒯.磁绯0W
31、牺?帼醐u:认酸f卜么?WaMr小虬并为共使M秘泮话梅做的*对翻晒整微n就认州维:恸糊Itty搬值为力string三aswm隔物加】.2fminsertMaia*;pdlicclass版IpilicstaticroidOBin(StnrKars!)inti,s=0;i11ta(10,20,30,40,5(1,KI.TO.80,)I;far(i=0;iaIeftjth;i+)if(ai3=0)sa(i:Sst的M,priulnsf):)bs=lS)3Kft7.IiCclassfetrrayblicstaticvoid11in(Stringa,gs)ji11ti,j;intaJ=59G&7Hfor
32、(i:0;ia.ImRtH;i11Kintk=i:for(j=i:ja.Inigth:j11)if(ajak)k=J;intUfP=ai;ai=ak:ak=top:)for(i=O:ia.Iergth;i+)Sjstoiout.trimfe(if*);st:5钟赭场裕抻有机根帝那!蜘上S旧处麹Slrir曲mr册工擦这视!法啊?这微去陶界微和j七抻JWN三膝雌分树的噱旗热相也削到只肥碓用点旃.6Jawf三fM-)蝉微件.三J7三,iara.(2Si洋JaVa珊净.使用WaSi附(、说az.exC*牺又除IW恻文件.(3)isj8aB惭柏帼Jm料图Oacw)懈僦浒瞅傩【略州Ia和微耐I哪(I)相侧
33、渊球互神同际供像拓展妙(3)献翔蹦咖融2温泄箍Z的碱崩柞明?m三用懈戒也它会出联眦时加件曲亚卿U而普通方源如蝴的用以公三tk在定义随今抄区求感容我容喉劭法纳前瞅ffH值替聊巩励法T稚城IWg恻阳-t-3做的印懒睇兜、主砌碑本要理面刷的股枇(蹄)跳神业(I)M客跚假fW阁阚轴时,却网*肺码的榔魅和fe三-不幽樵浏州的三懒礴烦了冬杯KI旗钠上就双十客薛例.ft三三础W下,mttiriU四河锁(KWH定)部的蟠5W曝令这个ttil蚁徽的面找阿籁都期解旅愎时no方渊拚,钞三w隔:Imm个幽初娜好则叫解和椭/内脚IHSw怀我界襁时初翩a互三锹K酿叫侬螂英e谏三i拥.辩府啖曲IWis布.钟加耐,椰的物即账f陀门?三a制MMwII关新供触荏0)力潟冲Mwm构邸际株睡橄崂爱怪哪瞰r徽侬初喉(3网EiGC这例操IW愫龊懒邙的切球而且可以由地廊时象的爵设itm所般、O