CS/CE 1337 – PROJECT 1 Geometric Volume Calculator

$30.00

Category:

Description

5/5 - (4 votes)

Problem: Write a C++ program that calculates the volume of three geometrical shapes: a dumbbell, a
spear and an axle. The user will make a selection via a menu, with an option for each shape as well as
an option to exit the program. The program should continue to run until the user decides to exit.
The shapes listed above are composed of basic geometric shapes:
 Dumbbell – two spheres connected by a rod (cylinder)
 Spear – two cones connected by a rod
 Axle – two cylinders connected by a rod
You may assume the rod connects snugly to the objects on the end with no air gap.
Input: Valid input for dimensions consists of any positive number less than or equal to 1 million. You
may assume that all input will be numeric. If the user enters an improper value for any input, an
appropriate error message should be displayed. Assume that all measurements are in inches.
The radius of the rod for a dumbbell or axle may not be more than half the radius of the objects on the
end. The radius of the spear’s cone base must be the same as the radius of the rod connecting the
cones.
Output: Final calculations are to be rounded to three decimal places. Output displayed to the user
should contain the name of the object selected, the dimensions entered by the user and the total
volume of the object with the appropriate label.
Formulas:
 Volume of a sphere:

 Volume of a cone:

 Volume of a cylinder: