I would solve this using tangents. Let h be height of flagpole.
Set up 2 right triangles, each with a base of 40.
The larger triangle has height of "h+70"
Smaller triangle has height of 70.
Now write the tangent ratios:
\(tan A = \frac{h+70}{40} , tan B = \frac{70}{40}\)
Note: A-B = 9
To solve for h we need to use the "Difference Angle" formula for Tangent
\(tan (A-B) = \frac{tanA - tanB}{1+tan A tan B}\)
Plug in what we know:
\(tan(9) = \frac{ \frac{h+70}{40} - \frac{70}{40}}{1+ (\frac{h+70}{40})(\frac{7}{4})}\)
\(tan (9) = \frac{ \frac{h}{40}}{ \frac{7h +650}{160}} = \frac{4h}{7h+650}\)
\(h = \frac{650 tan(9)}{4-7 tan(9)}\)
\(h = 35.6\)