219k views
0 votes
Simple geometry can compute the height of an object from the object's shadow length and shadow angle using the formula: tan(angleElevation) = treeHeight / shadowLength. 1. Using simple algebra, rearrange that equation to solve for treeHeight. (Note: Don't forget tangent). 2. Complete the below code to compute treeHeight. For tangent, use the tan() function, described in the "math functions" link above.

User Mletterle
by
6.5k points

1 Answer

4 votes

Answer:

1. Modified formulae for calculating tree height.


treeHeight = tan(angleElevation)* shadowLength.

2. C++ program to calculate tree height.

#include<iostream>

#include<math.h>

using namespace std;

int

main ()

{

double treeHeight, shadowLenghth, angleElevation;

cout << "Please enter angle of elevation and shadow length" << endl;

cin >> angleElevation;

cin >> shadowLenghth;

//Modified formulae to calculate tree height.

treeHeight = tan (angleElevation) * shadowLenghth;

cout << "Height of tree is:" << treeHeight;

}

Output:

Please enter angle of elevation and shadow length

45

12

Height of tree is:19.4373

Step-by-step explanation:

Since no programming language is mentioned, so solution is provided using C++.

In the above C++ program, first angle of elevation and length of shadow provided by user will be stored in variables angleElevation and shadowLength.

Then using the modified formalue height of tree will be calculated and stored in variable treeHeight. Final result is displayed to user.

User Foram Kantaria
by
6.5k points