六題 JAVA CODE問題




立即點擊


1.Inthefollowingcodesegment,aisaStringrepresentingadoubleandbisadouble.Writecodethatstoresinbthedoublethatis0.001morethanthedoublethatarepresents.Forexample,ifacontains"88.7263"thenbshouldcontain88.7273.Code:Stringa="";double...顯示更多1.Inthefollowingcodesegment,aisaStringrepresentingadoubleandbisadouble.Writecodethatstoresinbthedoublethatis0.001morethanthedoublethatarepresents.Forexample,ifacontains"88.7263"thenbshouldcontain88.7273.Code:Stringa="";doubleb;.....?2.Inthefollowingcodesegment,aisanintandx,yandzeachcontainaString.WritecodethatstoresinathecombinedlengthofthesethreeStrings.Code:Stringx="";Stringy="";Stringz="";inta;.....?3.Inthefollowingcodesegment,misaStringandpisaStringthatcontainsatleastoneoccurrenceofthecapitalletter"V".WritecodethatstoresinmtheStringcontainingthefirstoccurrenceinpof"V"andallthesubsequentcharacters.Forexample,ifpistheString"REVIVE"then"VIVE"shouldbestoredinm.Code:Stringp="";Stringm;......?4.Inthefollowingcodesegment,s,h,andtareStrings.TheStringstoredinhisthenameofoneoftheabovethreeHTMLtags.WritecodethatstoresinthevariablettheHTMLcodethatwillcausetheStringstobedisplayedinawebbrowserinthemannerspecifiedbythetagnamedbyh.Code:Strings="";Stringh="b"or"em"or"strike"Stringt;.....?5.Inthefollowingcodesegment,xandyareStringsandtheStringycontainsasimpleHTMLtagconsistingofaleftanglebracket,"<",atagname(aStringconsistingofoneormorelettersonly)andarightanglebracket,">".Writecodethatstoresthetagnameinx.Forexample,ifyis"
"thenxshouldevaluateto"div".Code:Stringy="";Stringx;......?更新:第四題有問題!更新2:還有第六題我發在另一個問題上了!更新3:我可能問的不好!那個Stringh"b"或"em"或是"strike"試題目的問題:例子:Strings="Strikeout";Stringh="Strike";Stringt;.....?Answer:"Strikeout!"更新4:Answer:"Strikeout!"剛剛打錯了更新5:"Strikeout!"





只有五題而已 1. b= Double.parseDouble(a) + 0.001; 2. a=x.length() + y.length() + z.length(); 3. m = p.substring(p.indexOf('V')); 4. if (h=="b") t = "" + s; else if (h=="em") t = "" + s + ""; else t = "" + s ; 5. x =y.substring(1,y.length()-1); 2008-09-22 09:18:39 補充: 第四題有問題! 在看一次題目,改成以下比較好 if (h=="b") t = "" + s; else if (h=="em") t = "" + s ; else t = " " + s ; 2008-09-22 14:52:36 補充: 更正(上面最後一行打錯了) if (h=="b") t = "" + s; else if (h=="em") t = "" + s; else t = " " + s ; 2008-09-22 14:55:13 補充: 知識家的bug,最後一行修正為 t="<strike>" + s; '請將<>改為英數半形 2008-09-23 09:37:14 補充: 那我知到了. 意思是 Tag都要成對 //請將<>,改為英數半形 if (h=="b") t = "<b>" + s + "</b>"; else if (h=="em") t = "<em>" + s + "</em>"; else t = "<strike>" + s + "</strike>";








以上文章來自奇摩知識家,如有侵犯請留言告知


https://tw.answers.yahoo.com/question/index?qid=20080918000016KK10799

EAAF9F75B34A6387
arrow
arrow

    百萬學堂 發表在 痞客邦 留言(0) 人氣()