MAE 9: Homework #2, Fall 2008
Due on Monday, October 13, Turnin from 9:00am - 9:00pm
Compute the area (A) and the volume (V) of a sphere with
radius R=0.1, R=0.2, R=0.3, .
.. , R=1.5 . Compute also the
total area (TA) and the total volume (TV) of all these spheres
together. Finally, compute the average radius, average area, and
average volume of considered spheres (R_av, A_av, V_av).
Define PI by using #define and use a for-loop to repeat
calculations for different values of R. (Use PI=3.141593 and recall
the elementary formulas A=4*PI*R*R and V=4*PI*R*R*R/3 or V=A*R/3).
For each sphere, print in one line
Radius = "number"
Area = "number"
Volume = "number"
At the end, in a separate line, print
Total Area = "number"
Total Volume = "number"
In a separate line print also:
Average Radius = "number"
Average Area = "number"
Average Volume = "number"
Use the output specifier 2d for k (k is a sequential number of the sphere),
4.1f for R, and 7.3f for A, V, TA, TV, R_av, A_av, V_av.