188k views
1 vote
Simple geometry can compute the height of an object from the object's shadow length and shadow angle using the formula: tangent(angleElevation) = treeHeight / shadowLength.

1. Using simple algebra, re-arrange that equation to solve for treeHeight.
2. Complete the code to compute treeHeight. For tangent, use the Math.tan() method, described in the "math methods" link.
Sample program:
#include
#include
int main(void) {
double treeHeight = 0.0;
double shadowLength = 0.0;
double angleElevation = 0.0;
angleElevation = 0.11693706; // 0.11693706 radians = 6.7 degrees
shadowLength = 17.5;

printf("Tree height: %lf\\", treeHeight);
return 0;
}.

1 Answer

1 vote

Answer:

see explaination

Step-by-step explanation:

treeHeight = shadowLength * Math.tan(angleElevation);

import java.util.Scanner;

import java.lang.Math;

public class TreeHeight {

public static void main(String [] args) {

double treeHeight = 0.0;

double shadowLength = 0.0;

double angleElevation = 0.0;

angleElevation = 0.11693706; // 0.11693706 radians = 6.7 degrees

shadowLength = 17.5;

/* Your solution goes here */

treeHeight = shadowLength * Math.tan(angleElevation);

System.out.print("Tree height: ");

System.out.println(treeHeight);

return;

}

}

User Thraka
by
5.6k points