华工Java语言程序设计作业答案1-.doc
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_1.gif)
![资源得分’ title=](/images/score_05.gif)
《华工Java语言程序设计作业答案1-.doc》由会员分享,可在线阅读,更多相关《华工Java语言程序设计作业答案1-.doc(14页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、华南理工大学学生实验报告书实验名称java课程实验课程名称Java语言程序设计课程号学院软件学院专业软件工程班级学生姓名*学号*实验地点实验日期第一章1.3public class Exe1_3 public static void main(String args) System.out.println( J A V V A); System.out.println( J A A V V A A); System.out.println(J J AAAAA V V AAAAA); System.out.println( J J A A V A A); 第二章2.21import java.u
2、til.Scanner;public class Exe2_21 public static void main(String args) System.out.println(Enter three points for triangle : ); Scanner input = new Scanner(System.in); double x1 = input.nextDouble(); double y1 = input.nextDouble(); double x2 = input.nextDouble(); double y2 = input.nextDouble(); double
3、 x3 = input.nextDouble(); double y3 = input.nextDouble(); double side1 = Math.sqrt( (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) ); double side2 = Math.sqrt( (x1-x3)*(x1-x3) + (y1-y3)*(y1-y3) ); double side3 = Math.sqrt( (x2-x3)*(x2-x3) + (y2-y3)*(y2-y3) ); double s = (side1 + side2 + side3) / 2; double area =
4、 Math.sqrt( s * (s-side1) * (s-side2) * (s-side3) ); System.out.println(The area of the triangle is + area); 第三章3.27import java.util.Scanner;public class Exe3_27 public static void main(String args)final double x1 = 0;final double y1 = 0;final double x2 = 200;final double y2 = 0;final double x3 = 0;
5、final double y3 = 100;Scanner input = new Scanner(System.in);System.out.println(Enter a points x- and y-coordinates : );double x = input.nextDouble();double y = input.nextDouble();double y_x = -(x/2) + 100;if( xx1 & xx3 )System.out.println(The point is not in the triangle!);else if( yy1 & yy_x )Syst
6、em.out.println(The point is not in the triangle!);elseSystem.out.println(The point is in the triangle!); 3.29import java.util.Scanner;public class Exe3_29 public static void main(String args)Scanner input = new Scanner(System.in);System.out.println(Enter circle1s center x- ,y-coordinates and radius
7、: );double x1 = input.nextDouble();double y1 = input.nextDouble();double r1 = input.nextDouble();System.out.println(Enter circle2s center x- ,y-coordinates and radius : );double x2 = input.nextDouble();double y2 = input.nextDouble();double r2 = input.nextDouble();double length = Math.sqrt( (x1-x2)*(
8、x1-x2) + (y1-y2)*(y1-y2) );double L1 = Math.abs( r1 - r2 );double L2 = r1 + r2;if(length = L1)System.out.println(circle2 is in circle1!);else if(length = L2)System.out.println(circle2 overlaps circle1!);elseSystem.out.println(circle2 does not overlap circle1);第四章4.25public class Exe4_25 public stati
9、c void main(String args)double PI = 0,sum = 0;int i, n;for( i = 10000; i = 100000; i += 10000 )for( n = 1; n max)max = integer;count = 1;else if(integer max)elsecount+=1;System.out.println(The largest number is + max);System.out.println(The occurence count of the largest number is + count);第五章5.21im
10、port java.util.Scanner;public class Exe5_21 public static void main(String args)Scanner input = new Scanner(System.in);double ary = new double10;System.out.println(Enter ten numbers : );for (int i = 0; i ary.length; i+ )aryi = input.nextDouble();double sum = 0, sum_pow = 0;for (int i = 0; i ary.leng
11、th; i+)sum += aryi;for (int i = 0; i ary.length; i+)sum_pow += aryi*aryi;double mean = sum/ary.length;double standard_value = Math.sqrt(sum_pow - sum*sum/ary.length) / (ary.length - 1.0) );System.out.println(The mean is + mean);System.out.println(The standard deviation is + standard_value);第六章6.18im
12、port java.util.Scanner;public class Exe6_18 public static void main (String args) System.out.print(Enter ten real number : ); double array = new double10; Input(array); Sort(array); Output(array); /输入 public static void Input(doubleary) Scanner input = new Scanner(System.in); for(int i = 0; i ary.le
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 华工 Java 语言程序设计 作业 答案
![提示](https://www.taowenge.com/images/bang_tan.gif)
限制150内