Java code

profileabdbak

    Given the corner points of a triangle (x1, y1), (x2, y2), (x3, y3), compute the area.

Hint: The area of the triangle with corner points (0, 0), (x1y1), and (x2y2) is |x1 · y2 - x2 · y1| / 2.

Complete the following code:

 

public class Geometry
{
   /**
      A method to return the smaller of two integers
      @param a, the first integer
      @param b, the second integer
      @return small, the smaller of the two
   */
   public static double triangleArea(double x1, double y1,
      double x2, double y2, double x3, double y3)
   {
      ...
   }
}
    • 10 years ago
    • 5
    Answer(0)
    Bids(0)