Question: Problem: You will create a program in C++ that will approximate the volume of pores in a new composite material. While the material is being
Problem: You will create a program in C++ that will approximate the volume of pores in a new composite material. While the material is being formed it is injected with air which creates bubble and pores to decrease the density of the composite material. However, if too many pores and bubbles are created, the material loses its strength and catastrophic failure occurs. You are to create a program that will determine what percentage of the material is due to pores (connected to the surface) and bubbles (totally enclosed within the sample). For the purposes of this analysis all bubbles will be assumed to be the same size and all the pores will be cylinders of the same size.
The sample that is being analyzed is a rectangular parallelepiped (all angles are 90 degrees, but length, width, and height may be different values). The user will be prompted to enter the dimensions of the sample (height, length, and width), the number of the bubbles, the radius of the bubbles, the number of cylindrical pores, the radius of the cylindrical pores and the height of the cylindrical pores.
A void function that will robustly confirm that the dimension entered is greater than zero.
This function should accept two parameters: the dimension and what the dimension corresponds to e.g. the height of the sample, the radius of spherical bubble, etc.(see examples below). This function should contain a single loop and no selection structures. If the dimension is incorrect, the user should be told what dimension is incorrect and prompt the user to re-enter the value for the dimension.
A valid value should be sent back to main.
A value-returning function will accept the radius of a sphere then calculate and return
the volume of a sphere (vol = 4/3r3).
A value-returning function that will accept the radius and height of a cylinder, then
calculate and return the volume of a cylinder (vol = r2h).
A value-returning function that accept the height, length, and width of a rectangular parallelepiped then calculate and return the volume of the rectangular parallelepiped (vol = hlw).
A value-returning function that will accept 8 parameters: width, length, and height of the parallelepiped sample; the number of spherical bubbles and the radius of the bubbles; plus the number of cylindrical holes in contact with a surface and the radius and height of these cylinders. This function will call the functions to calculate the volumes, then calculate the percent of the sample that is air (combination of spherical bubbles and cylindrical pores). The percentage should be returned to the function call.
Your main function should ask the user to input the dimensions of the parallelepiped smple, 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 valid. After this confirmation, the function to determine the percentage of air present should be called. Then the main function should output the percentage of air present. The percentage of air should be output using 3 significant digits. You may assume that the total volume of spherical bubbles and cylindrical pores will not exceed the volume of the original sample.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
