Java语言程序设计(基础篇)原书第十版梁勇著第一章答案

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

第一章1.1publicclassTest{publicstaticvoidmain(String[]args){System.out.println(WelcometoJava!);System.out.println(WelcometoComputerScience!);System.out.println(Programmingisfun.);}}1.2publicclassTest{publicstaticvoidmain(String[]args){for(inti=0;i=4;i++){System.out.println(WelcometoJava!);}}}1.3publicclassTest{publicstaticvoidmain(String[]args){System.out.println(]);System.out.println(]);System.out.println(]]);System.out.println(]]);}}publicclassTest{publicstaticvoidmain(String[]args){System.out.println(A);System.out.println(AA);System.out.println(AAAAA);System.out.println(AA);}}publicclassTest{publicstaticvoidmain(String[]args){System.out.println(VV);System.out.println(VV);System.out.println(VV);System.out.println(V);}}1.4publicclassTest{publicstaticvoidmain(String[]args){System.out.println(aa^2a^3);System.out.println(111);System.out.println(248);System.out.println(3927);System.out.println(41664);}}1.5publicclassTest{publicstaticvoidmain(String[]args){System.out.println((9.5*4.5-2.5*3)/(45.5-3.5));}}1.6publicclassTest{publicstaticvoidmain(String[]args){inti=1,sum=0;for(;i=9;i++)sum+=i;System.out.println(sum);}}1.7publicclassTest{publicstaticvoidmain(String[]args){System.out.println(4*(1.0-1.0/3+1.0/5-1.0/7+1.0/9-1.0/11));System.out.println(4*(1.0-1.0/3+1.0/5-1.0/7+1.0/9-1.0/11+1.0/13));}}1.8publicclassTest{publicstaticvoidmain(String[]args){finaldoublePI=3.14;doubleradius=5.5;System.out.println(2*radius*PI);System.out.println(PI*radius*radius);}}1.9publicclassTest{publicstaticvoidmain(String[]args){System.out.println(7.9*4.5);System.out.println(2*(7.9+4.5));}}1.10publicclassTest{publicstaticvoidmain(String[]args){doubleS=14/1.6;doubleT=45*60+30;doublespeed=S/T;System.out.println(speed);}}1.11publicclassTest{publicstaticvoidmain(String[]args){intBN=312032486;//originalpersonnumbersdoubleEveryYS,EveryYBP,EveryYDP,EveryYMP;EveryYS=365*24*60*60;EveryYBP=EveryYS/7;EveryYDP=EveryYS/13;EveryYMP=EveryYS/45;intFirstYP,SecondYP,ThirdYP,FourthYP,FivthYP;FirstYP=(int)(BN+EveryYBP+EveryYMP-EveryYDP);SecondYP=(int)(FirstYP+EveryYBP+EveryYMP-EveryYDP);ThirdYP=(int)(SecondYP+EveryYBP+EveryYMP-EveryYDP);FourthYP=(int)(ThirdYP+EveryYBP+EveryYMP-EveryYDP);FivthYP=(int)(FourthYP+EveryYBP+EveryYMP-EveryYDP);System.out.println(FirstYP);System.out.println(SecondYP);System.out.println(ThirdYP);System.out.println(FourthYP);System.out.println(FivthYP);}}1.12publicclassTest{publicstaticvoidmain(String[]args){doubleS=24*1.6;doubleT=(1*60+40)*60+35;doublespeed=S/T;System.out.println(speed);}}1.13importjava.util.Scanner;publicclassTest{publicstaticvoidmain(String[]args){Scannerinput=newScanner(System.in);System.out.println(inputa,b,c,d,e,fvalueplease:);doublea=input.nextDouble();doubleb=input.nextDouble();doublec=input.nextDouble();doubled=input.nextDouble();doublee=input.nextDouble();doublef=input.nextDouble();doublex,y;x=(e*d-b*f)/(a*d-b*c);y=(a*f-e*c)/(a*d-b*c);System.out.println(Theresultisx:+(int)(x*1000)/1000.0);System.out.println(Theresultisy:+(int)(y*1000)/1000.0);}}

1 / 4
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功