Building Triangles
From Huben's Wiki
Line 16: | Line 16: | ||
* a sideLength() method that takes two integer arguments which are the indexes of two points in the array. Example: sideLength(0, 2). It should use the Point.distance() method to calculate the answer. | * a sideLength() method that takes two integer arguments which are the indexes of two points in the array. Example: sideLength(0, 2). It should use the Point.distance() method to calculate the answer. | ||
* a perimeter() method that anybody can use which returns the perimeter of the Triangle. | * a perimeter() method that anybody can use which returns the perimeter of the Triangle. | ||
− | * an area() method that anybody can use, | + | * an area() method that anybody can use, [http://www.mathopenref.com/coordtrianglearea.html which uses this formula] or [http://en.wikipedia.org/wiki/Heron%27s_formula Heron's formula]. Remember that the functions you'll need are in class Math. |
* a toString() method that has no arguments and returns a String describing the Triangle by its three points, its side lengths, its perimeter and its area. | * a toString() method that has no arguments and returns a String describing the Triangle by its three points, its side lengths, its perimeter and its area. | ||