Write a statement that assigns treeHeight with the height of a tree given the distance from the tree (in feet) and angle of elevation (in degrees).

Use the following formula: tangent of angleElevation treeHeight/ treeDistance treeHeight

Respuesta :

Answer:

treeHeight = tangent of angleElevation * treeDistance

In java, we could write it as:

double treeHeight = (Math.tan(angleElevation) * treeDistance);

Math.tan(angleElevation) is an inbuilt java mathematical function used to calculate the tangent of a value and the return value is always double.

Explanation:

formula:

tangent of angleElevation = treeHeight/treeDistance

We want to assign treeHeight, so we cross-multiply and we get:

treeHeight = tangent of angleElevation * treeDistance

Off course, the treeHeight will be in feet also.