adamliu84
发贴: 2
积分: 0
|
于 2005-01-14 00:06
public class AreaOfSchoolNew2 { public static void main(String[] args) { double i,s,num; int m,j; System.out.println("please input How many triangles in this Area:"); int n=MyInput.readInt(); double [][] a = new double [n][3]; System.out.println("please ENTER the three length of the triangle's lines:"); for (m=0;m<n;m++) { for (j=0; j<a[0].length; j++) a [m][j]=MyInput.readDouble(); System.out.println("please ENTER the other three length of the triangle's lines:"); } double total = num (double[][] a, int n) if (total<=0) System.out.println("The ENTER numbers are wrong!!!"); System.out.println("The campus's area is "+total+"square meters"); } public static double num (double[][] site, int n ){ int i; double s, num; for (i=0;i<n;i++) { s=0.5*(site[i][0]+site[i][1]+site[i][2]);
num=Math.sqrt(s*(s-site[i][0])*(s-site[i][1])*(s-site[i][2])); } for (i=0; i<n; i++) { num=+num; num=num*20000*20000/10000; }
return num ; } }
|