资源描述:
《java入门程序题及源码1》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、一.实验目的学会安装并熟悉JDK,JRE,BlueJ软件及其相应的环境变量的设置,会编一些简单的java入门小程序。二.实验内容实验题目一:对“HelloWorld”程序进行改造,能够显示一张发给朋友的贺卡。格式如下:******************************张三,你好!祝你学习愉快! 你的好朋友:李四2012年10月10日********************************1.解题要点及算法分析在Helloword程序代码中把输出改成所需要输出的字符串即可。2.程序源代码publicclasscard{publicstaticvoidma
2、in(String[]args){System.out.println("******************************张三,你好!祝你学习愉快!你的好朋友:李四2012年10月10日******************************");}}3.实验结果otherstaffoftheCentre.Duringthewar,ZhuwastransferredbacktoJiangxi,andDirectorofthenewOfficeinJingdezhen,JiangxiCommitteeSecretary.Star
3、tingin1939servedasrecorderoftheWestNorthOrganization,SecretaryoftheSpecialCommitteeAfterthevictoryofthelongMarch,hehasbeentheNorthwestOfficeoftheFederationofStateenterprisesMinister,ShenmufuguSARmissions,DirectorofNingxiaCountypartyCommitteeSecretaryandrecorderoftheCountypartyCommitteeSe
4、cretary,Ministersand实验题目二:完成课堂上的圆类和主类1.程序源代码packagemyhome;importjava.util.*;publicclass主类{publicstaticvoidmain(Stringa[]){Scannersc=newScanner(System.in);圆类圆1=new圆类();System.out.print("请输入半径1:");圆1.半径=sc.nextDouble();doublearea1=圆1.面积();System.out.printf("圆1的面积=%10.2fr",area1);圆类圆2=ne
5、w圆类();System.out.print("请输入半径2:");圆2.半径=sc.nextDouble();doublearea2=圆2.面积();System.out.printf("圆2的面积=%10.2fr",area2);圆类圆3=new圆类();System.out.print("请输入半径3:");圆3.半径=sc.nextDouble();doublearea3=圆3.面积();System.out.printf("圆3的面积=%10.2fr",area3);}}packagemyhome;publicclass圆类otherstaffof
6、theCentre.Duringthewar,ZhuwastransferredbacktoJiangxi,andDirectorofthenewOfficeinJingdezhen,JiangxiCommitteeSecretary.Startingin1939servedasrecorderoftheWestNorthOrganization,SecretaryoftheSpecialCommitteeAfterthevictoryofthelongMarch,hehasbeentheNorthwestOfficeoftheFederationofStateente
7、rprisesMinister,ShenmufuguSARmissions,DirectorofNingxiaCountypartyCommitteeSecretaryandrecorderoftheCountypartyCommitteeSecretary,Ministersand{privatedouble半径;publicstaticintcount;finalintMAXVALUE;protectedint坐标;public圆类(){半径=0;MAXVALUE=10000;}public圆类(double半径2){半径=半径2;M