题目:
编写一个方法,使用下面的方法头,返回一个三角形的面积:
public static double getTriangleArea(double[][] points)
三角形三个点的坐标(x1,y1)、(x2,y2)和(x3,y3)
保存在一个3 x 2的二维矩阵points中,
其中(points[0][0],points[0][1])代表(x1,y1)。
编写一个程序,提示用户输入三角形的三个点,然后显示三角形的面积。
程序源码如下:
package com;
import java.util.Scanner;
public class test {
public static void main(String[] args) {
System.out.println(“请输入3个坐标的值:”);
double[][] points = new double[3][2];
Scanner in = new Scanner(System.in);
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 2; j++) {
points[i][j] = in.nextInt();
}
}
getTriangleArea(points);
}
public static double getTriangleArea(double[][] points){