You need the angle of the line between the shadow and the line from the extreme of the shadow to the cup ot the tree.
Suppose that the angle is the same of a right triangle with a base of 5 ft and a tall of 2 ft.
=> 2/5 = x / 30ft => x = 30ft * 2 / 5 = 12ft
=> The tree is 12 ft tall.
And the two triangles are similar (they have same angles).