The altitude of the right triangle is the geometric mean of the 2 parts of the side it separates.
a. The answer would be sqrt(18*32)=24
The question to the second question can be answered by using the Pythagorean theorem.
32^2+24^2=1600=40^2
b. The answer would be sqrt40^2=40
1 mile = 5280 feet
5280 * 3/5 = 3168 feet more to go
Whole numbers if I remember correctly!

y2 - y1 / x2 - x1 = slope