[Back to Lab 2] [Back to CS 115 schedule]
In this part of the lab, we will extend our program from Part D to compute the volume of a sphere, given the length of the radius.
Recall that the volume of a sphere with radius r can be calculated as:
V = 4/3 * π * r3
Here is a sample of what your revised program will do. The user's input is italicized and underlined.
Enter a numeric value: 10
The area of a square with side length 10.0 is 100.0.
The area of a circle with radius length 10.0 is 314.159265359.
The volume of a cube with edge length 10.0 is 1000.0.
The volume of a sphere with radius length 10.0 is 4188.79020479.
Enter a numeric value: 10
The area of a square with side length 10.0 is 100.0.
The area of a circle with radius length 10.0 is 314.159265359.
The volume of a cube with edge length 10.0 is 1000.0.
The volume of a sphere with radius length 10.0 is 4188.79020479.