欢迎来到天天文库
浏览记录
ID:34037174
大小:66.99 KB
页数:64页
时间:2019-03-03
《[工学]java语言程序设计基础篇英文8版课后习题答案》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、publicclassExercise1_2{publicstaticvoidmain(String[]args){System.out.println("WelcometoJava");System.out.println("WelcometoJava");System.out.println("WelcometoJava");System.out.println("WelcometoJava");System.out.println("WelcometoJava");}}publicclassExercise1_4{publicstaticvoidmain(String[]
2、args){System.out.println("aa^2a^3");System.out.println("111");System.out.println("248");System.out.println("3927");System.out.println("41664");}}publicclassExercise1_6{publicstaticvoidmain(String[]args){System.out.println(1+2+3+4+5+6+7+8+9);}}publicclassExercise1_8{publicstaticvoidmain(Strin
3、g[]args){//DisplayareaSystem.out.println(5.5*5.5*3.14159);//DisplayperimeterSystem.out.println(2*5.5*3.14159);}}importjavax.swing.JOptionPane;publicclassExercise2_1WithDialogBox{//Mainmethodpublicstaticvoidmain(String[]args){//EnteratemperaturinFahrenheitStringcelsiusString=JOptionPane.showI
4、nputDialog(null,"EnteratemperatureinCelsius:","Exercise2_1Input",JOptionPane.QUESTION_MESSAGE);//Convertstringtodoubledoublecelsius=Double.parseDouble(celsiusString);//ConvertittoCelsiusdoublefahrenheit=(9.0/5)*celsius+32;//DisplaytheresultJOptionPane.showMessageDialog(null,"Thetemperatureis
5、"+fahrenheit+"inFahrenheit");}}importjava.util.Scanner;publicclassExercise2_2{publicstaticvoidmain(String[]args){Scannerinput=newScanner(System.in);//EnterradiusofthecylinderSystem.out.print("Enterradiusofthecylinder:");doubleradius=input.nextDouble();//EnterlengthofthecylinderSystem.out.pri
6、nt("Enterlengthofthecylinder:");doublelength=input.nextDouble();doublevolume=radius*radius*3.14159*length;System.out.println("Thevolumeofthecylinderis"+volume);}}publicclassExercise2_4{publicstaticvoidmain(String[]args){//Prompttheinputjava.util.Scannerinput=newjava.util.Scanner(System.in);S
7、ystem.out.print("Enteranumberinpounds:");doublepounds=input.nextDouble();doublekilograms=pounds*0.454;System.out.println(pounds+"poundsis"+kilograms+"kilograms");}}//Exercise2_6.java:Summarizealldigitsinaninteger<1000publicclassExercise2_6{//Mainme
此文档下载收益归作者所有