Question: Write a method that returns the area of a triangle using the following header:public static double?getTriangleArea(double[][] points)The points are stored in a 3-by-2 two-dimensional array
Write a method that returns the area of a triangle using the following header:public static double?getTriangleArea(double[][] points)The points are stored in a 3-by-2 two-dimensional array points with points[0] [0] and points[0][1] for (x1, y1). The triangle area can be computed using the formula in Programming Exercise 2.19. The method returns 0 if the three points are on the same line. Write a program that prompts the user to enter three points of a triangle and displays the triangle's area. Here is a sample run of the program:
Enter x1, y1, 2, 2, 3, 3: 2.5 2 5 -1.0 4.0 2.0 The area of the triangle is 2.25 - Enter Enter x1, yl, 2, 2, 3, 3: 2 2 4.5 4.5 6 6 The three points are on the same line -Enter
Step by Step Solution
3.44 Rating (151 Votes )
There are 3 Steps involved in it
Program plan Create getTriangleArea method so that accepts an array of points of type double and the... View full answer
Get step-by-step solutions from verified subject matter experts
