《Java语言程序设计:基础篇》课后复习题答案
Chapter5Methods
1.Atleastthreebenefits:(1)Reusecode;(2)Reducecomplexity;(3)Easytomaintain.SeetheSections5.2and5.3onhowtodeclareandinvokemethods.Whatisthesubtledifferencebetween“definingamethod”and
“declaringavariable”?Adeclarationusuallyinvolvesallocatingmemorytostoreavariable,butadefinitiondoesn’t.2.3.4.5.
void
Yes.return(num1>num2)?num1:num2;
True:acalltoamethodwithavoidreturntypeisalwaysastatementitself.
False:acalltoavalue-returningmethodisalwaysacomponentofanexpression.Asyntaxerroroccursifareturnstatementisnotusedtoreturnavalueinavalue-returningmethod.Youcanhaveareturnstatementinavoidmethod,whichsimplyexitsthemethod.Butareturnstatementcannotreturnavaluesuchasreturnx+yinavoidmethod.SeeSection5.2.
ComputingasalescommissiongiventhesalesamountandthecommissionratepublicstaticdoublegetCommission(doublesalesAmount,doublecommissionRate)
Printingacalendarforamonth
publicstaticvoidprintCalendar(intmonth,intyear)Computingasquareroot
publicstaticdoublesqrt(doublevalue)
TestingwhetheranumberisevenandreturntrueifitispublicstaticbooleanisEven(intvalue)
Printingamessageforaspecifiednumberoftimes
publicstaticvoidprintMessage(Stringmessage,inttimes)
Computingthemonthlypayment,giventheloanamount,numberofyears,andannualinterestrate.
publicstaticdoublemonthlyPayment(doubleloan,intnumberOfYears,doubleannualInterestRate)Findingthecorrespondinguppercaselettergivenalowercaseletter.
6.7.
java语言程序设计基础篇... 14页 3下载券喜欢此文档的还喜欢 款项支付管理制度 2页 免费《Java语言程序设计:...
《Java语言程序设计:基础篇》课后复习题答案-第二章_高等教育_教育专区。《Java语言程序设计:基础篇》课后复习题答案Chapter 2 Elementary Programming 1. radius ...
《Java语言程序设计:基础篇》课后复习题答案-第七章_高等教育_教育专区。《Java语言程序设计:基础篇》课后复习题答案Chapter 7 Multidimensional Arrays 1 2 3 4...
《Java语言程序设计:基础篇》课后复习题答案-第四章_高等教育_教育专区。《Java语言程序设计:基础篇》课后复习题答案Chapter 4 Loops 1. count < 100 always ...
《Java语言程序设计:基础篇》课后复习题答案-第十六章 《Java语言程序设计:基础篇》课后复习题答案《Java语言程序设计:基础篇》课后复习题答案隐藏>> Chapter 16 ...
JAVA语言程序设计复习题... 46页 免费《Java语言... 淘宝客推广操作基础68份文档 新市场营销法则 助推企业成长 999感冒灵市场营销...
C++课后习题答案第五章 14页 20财富值 Java实战经典(第五章课后题... 11... 第五章 复习题 弹性及其应用 1、需求价格弹性,是指一种物品需求量对其价格...
物理化学 傅献彩 课后复习题答案第一章至第五章_工学_高等教育_教育专区 暂无评价0人阅读0次下载举报文档 物理化学 傅献彩 课后复习题答案第一章至第五章_...
热学第五章课后习题答案_理学_高等教育_教育专区。不错的复习资料第五章答案 1.已知 M ? 0.020kg , ? ? 4 ?10?3 kg / mol, T1 ? 273? 17 ? ...
口腔执业医师实践技能复习资料 中医护理学基础重点 执业医师实践技能考试模拟试题... 机械设计_第五章课后习题... 7页 免费 c++ 课后习题答案 第五章... 2页...
热门文档