CS120
Programming Assignment #4
Due Sunday, Feb. 18th at midnight.
For this assignment you will be creating a calculator program for calculating
the volume or area of geometric solids.
The general program issimilar to Assignment 1B, but the program should
use functions for each of the
calculations.
As with Assignment 1b calculator program should work as follows:
- First the program should print a brief message explaining to the
user what the program does.
- Then the program allows the user to enter two values whose types
are double. Each of these two values needs to be stored in its
own variable. They correspond to the radius and height of the geometric solid.
- Next the user enters a third value, an integer, that corresponds to the
operation the user wants to have the program perform.
Include a loop to force the user to enter a valid choice.
- The operations that the calculator performs should be:
-
Calculating the surface area of a right circular cylinder. This calculation should be
done in a separate function, not in the main() function. The answer should
be returned and printed in main()
-
Calculating the volume of a right circular cylinder.
This calculation should be done in a separate function, not in the main()
function. The answer should be returned and printed in main()
-
Calculating the surface area of a right circular cone.
This calculation should be done in a separate function, not in the main()
function. The answer should be returned and printed in main().
-
Calculating the volume area of a right circular cone.
This calculation should be done in a separate function, not in the main()
function. The answer should be returned and printed in main().
- Extra Credit: Include a loop in the main program so the user can
keep performing calculations until they enter a particular value to exit from the program.
Turn in: A copy of the program and sample output showing it runs.
In the sample ouput make sure you show that you've tested all of the
functionality of the program.