You will create a program that will approximate the volume of cheese in a rectangular hunk of Swiss cheese. For this approximation you will assume that the holes in the Swiss cheese are of two types: spherical bubbles (all of the same size) or cylinders (also of the same size).
Your program should include 6 functions in addition to your main function:
- A void function that will *robustly confirm that the dimension entered is greater than zero. This function should accept 2 arguments: the dimension and what it is. You will call this function 6 times (to check: height of cheese, length of cheese, width of cheese, radius of spheres, radius of cylinders, height of cylinders).
- A void function that will *robustly confirm that the number entered for holes is greater than zero. This function should accept 2 arguments: the number of holes and what that number corresponds to: spherical bubbles or surface cylinders. You will call this function 2 times.
- A value-returning function that will accept the radius of a sphere, and then calculate and return the volume of that sphere (vol = 4/3pr3).
- A value-returning function that will accept the radius and height of a cylinder, and then calculate and return the volume of that cylinder (vol = pr2h).
- A value-returning function that will accept the height, length, and width of a rectangular parallelepiped and then calculate and return the volume of the rectangular parallelepiped (vol = hlw).
- A value-returning function that will accept 8 parameters: (1)width, (2)length, and (3)height of the rectangular hunk of cheese; the (4)number of spherical bubbles and the (5)radius of the bubbles; plus the (6)number of cylindrical holes in contact with a surface and the (7)radius and (8)height of these cylinders. This function will call the functions to calculate the volumes, and then subtract the volumes of spherical bubbles and surface cylinders from the total possible volume of the parallelepiped. The final volume should be returned to main() via the function call. If the volume of cheese is negative, you should handle this appropriately in main().
Your main function should ask the user to input the dimensions of the parallelepiped, the number and size of the spherical bubbles, and the number and dimensions of the surface cylinders. For each of these 8 values your main function should call the functions to confirm input is greater than 0. After this confirmation, the function to approximate the volume of cheese should be called. Then main should output the approximate volume of cheese present. DO NOT assume that the total volume of spherical bubbles and surface cylinders will not exceed the volume of the original hunk.
Make sure you use appropriate data types and that your submission follows the assignment guidelines posted on ANGEL. The value of pi should be declared as a global constant of 3.14159.
Note: for the "what it is" portion of the validity-checking functions, you will need to use a variable type that holds multiple characters.
*robustly confirm: if the item in question is invalid, the function will repeatedly check to make sure that valid input is eventually obtained.