Java语言程序设计 第三章课后题
文章平均质量分 52
差劲的厉害了
一个正在努力学习的大学生
展开
-
Java语言程序设计 例题3.17(游戏:石头剪刀布)
*3.17 (Game: scissor, rock, paper) Write a program that plays the popular scissor-rockpapergame. (A scissor can cut a paper, a rock can knock a scissor, and a paper canwrap a rock.) The program randomly generates a number 0, 1, or 2 representingscisso..原创 2022-05-17 00:33:18 · 1081 阅读 · 2 评论 -
Java语言程序设计 例题3.16(随机点)
3.16 (Random point) Write a program that displays a random coordinate in a rectangle.The rectangle is centered at (0, 0) with width 100 and height 200.3.16(随机点)编写一个程序,显示矩形中的随即坐标,矩形剧中于(0.0),宽100,高200。代码如下public class Unite3Test16 { public static.原创 2022-05-17 00:08:58 · 170 阅读 · 0 评论 -
Java语言程序设计 例题3.15
**3.15 (Game: lottery) Revise Listing 3.8, Lottery.java, to generate a lottery of a threedigitnumber. The program prompts the user to enter a three-digit number anddetermines whether the user wins according to the following rules:1. If the user input m.原创 2022-05-16 23:45:22 · 239 阅读 · 0 评论 -
Java语言程序设计 例题3.14
3.14(Game:headsortails)Writeaprogramthatletstheuserguesswhethertheflipofacoinresultsinheadsortails.Theprogramrandomlygeneratesaninteger0or1,whichrepresentsheadortail.Theprogrampromptstheusertoenteraguessand...原创 2022-05-16 00:30:10 · 203 阅读 · 0 评论 -
Java语言程序设计 例题3.13(计算税款)
*3.13(Financialapplication:computetaxes)Listing3.5,ComputeTax.java,givesthesourcecodetocomputetaxesforsinglefilers.CompleteListing3.5tocomputethetaxesforallfilingstatuses.*3.13(金融应用:计算税款)清单3.5给出了为单个申报者计算税收的源代码.完成清单3.5来计算所有...原创 2022-05-16 00:11:12 · 563 阅读 · 0 评论 -
Java语言程序设计 例题3.12(回文数)
3.12(Palindromenumber)Writeaprogramthatpromptstheusertoenterathree-digitintegeranddetermineswhetheritisapalindromenumber.Anumberispalindromeifitreadsthesamefromrighttoleftandfromlefttoright.Hereisasamplerunof...原创 2022-05-15 23:39:56 · 1353 阅读 · 0 评论 -
Java语言程序设计 例题3.10(游戏:加法检测)
3.10(Game:additionquiz)Listing3.3,SubtractionQuiz.java,randomlygeneratesasubtraction question.Revisetheprogramtorandomlygenerateanadditionquestionwithtwointegers lessthan100.3.10(游戏:加法检测)清单3.3随机产生一个减法问题.修改程序,随机生成两个小于100的整数的加法问...原创 2022-05-15 23:18:57 · 328 阅读 · 0 评论 -
Java语言程序设计 例题3.9(检验ISBN)
**3.9(Business:checkISBN-10)AnISBN-10(InternationalStandardBookNumber)consistsof10digits:d1d2d3d4d5d6d7d8d9d10.Thelastdigit,d10,isachecksum,whichiscalculatedfromtheotherninedigitsusingthefollowingformula:(d1*1+d2*2...原创 2022-05-15 22:55:03 · 874 阅读 · 0 评论 -
Java语言程序设计 例题3.8(对三个整数排序)
(Sort three integers)Write a program that prompts the user to enter three integers and display the integers in non-decreasing srder.(对三个整数排序)编写一个程序,提示用户输入三个整数,并按非递减顺序显示.代码如下(这种做法第一种很冗余,我进行学习后再优化)import java.util.Scanner;public class Unite3Test8D {原创 2022-05-15 12:23:33 · 769 阅读 · 0 评论 -
Java语言程序设计 例题3.7(金融应用程序:货币单位)
(Financial application :monetary unites)Modify Listing 2.10,ComputeChange.java,to display the nonzero denominations only,using singular words for single units such as 1dollar and 1penny,and plural words for more than one unite such as 2dollars and 3 pennie原创 2022-05-15 10:32:01 · 370 阅读 · 0 评论 -
Java语言程序设计 例题3.6(健康指标:BMI)
*3.6(Healthapplication:BMI)ReviseListing3.4,ComputeAndInterpretBMI,java,tolettheuserenterweight,feet,andinches.Forexample,ifapersonis5feetand10inches,youwillenter5forfeetand10forinches.Hereisasamplerun:Enterweighti...原创 2022-05-13 18:19:28 · 611 阅读 · 0 评论 -
Java语言程序设计 例题3.5(给出未来的日期)
*3.5(Find future dates)Write a program that prompts the user to enter an integer for today's day of the week(Sunday is 0,Monday is 1,...,and Saturday is 6).Also prompt the user to enter the number of days after today for a future day and display the future原创 2022-05-13 17:32:16 · 583 阅读 · 0 评论 -
Java语言程序设计 例题3.4 (调取随机月份)
**3.4(Random month)Write a program that randomly generates an integer between 1 and 12 and displays the English month name January,February,...,December for the number 1,2,3,...,12,accordingly.**3.4(随机月份)编写一个程序,随机生成1到12之间的整数,并显示英文月份名称January,February,...原创 2022-05-12 23:37:33 · 279 阅读 · 0 评论 -
Java语言程序设计 例题 3.3(解2×2线性方程)
*3.3(Algebra:solve 2×2linear equations)A linear equation can be solved using Crame's rule given in Programming Exercise 1.13 .Write a program that prompts the user to enter a,b,c,d,e,and,f and displays the result. If ad- bc is 0,report that "The equation h原创 2022-05-12 20:57:48 · 294 阅读 · 0 评论 -
Java语言程序设计 例题3.2(游戏:将三个数相加)
*3.2(Game: add three numbers) The program in Listing 3.1, AdditionQuiz.java, generates two integers and prompts the user to enter the summation of these two integers. Revise the program to generate three single-digit integers and prompt the user to en...原创 2022-05-11 23:42:01 · 602 阅读 · 0 评论 -
Java语言程序设计 例题3.11(查找一个月的天数)
*3.11(Find the number of days in a month) Write a program that prompts the user to enter the month and year and displays the number of days in the month. For example, if the user entered month 2 and year 2012, the program should display that February 2012原创 2022-05-10 23:07:44 · 902 阅读 · 2 评论 -
Java语言程序设计 例题3.1(代数:解一元二次方程)
*3.1(Algebra:solvequadraticeuations)Thetworootsofaquadratic equation ax^2+bx+c=0 can be obtain using the following formula:b^2➖4aciscalledthediscriminantofthequadraticequation.Ifitispositive,theequationhastworealroots.Ifitisz...原创 2022-05-11 20:54:23 · 497 阅读 · 0 评论