Lecture notes for the Introduction to Computer Science for non-majors by James Tam | Return to the course web page |
Write a geometry program that will calculate the following formulas: the area of a circle, and the are and volume of a sphere. The program will be menu operated with three options
(c)ircle: calculate the area.
Sphere:
The sphere calculations are as follows:
sphereSurfaceArea = 4 * PI * radius * radius
sphereVolume = 4/3 * PI * radius * radius * radius
Quit:
Unless this option is selected the program will continue displaying the above
menu options. When the user does decide to quit the program a brief
message should be displayed indicating that the program is now ending.