Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Computing the Area of a Triangle Given Its Corner Points: Use the template code Lab 9 Template.java for this exercise. Its main method creates a
Computing the Area of a Triangle Given Its Corner Points:
Use the template code LabTemplate.java for this exercise. Its main method
creates a D array with rows and columns,
reads the corner point coordinates of a triangle Ax
y
Bx
y
and Cx
y
from
the user into the D array then prints these corner point coordinates,
computes then prints the side lengths of the triangle a b and c from its corner points,
and computes then prints the area of the triangle using the Heron's formula.
Note: The last two methods described below are used in the main method.
Write a method that
has the header public static double distancedouble point double point
and computes then returns the Euclidean distance between the two points whose
coordinates are given as two arrays pointx y and pointx y
Write a second method that
has the header public static double computeSideLengthsdouble cornerPoints
computes the side lengths of a triangle by using the distance method explained above,
stores the result in an array and returns the array.
The corner points of the triangle are given to the method as a D array cornerPoints
Write a third method that
has the header public static double computeAreadouble sideLengths
and uses the Herons formula given on the right to compute then return the area of the
triangle whose side lengths are given as an array sideLengths
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started