For the following, write a program that reads the necessary information to compute and output the indicated values, as efficiently as possible. Following the pattern in the lab exercise, first, design using OCD; then code your design in C++ using stepwise translation; finally, test your program thoroughly.
For each of these projects, PI
should be declared as a
constant:
const double PI = 3.14159;
Project #3.1: Write a program to find the circumference and area of a circle. The formulas for these quantities are as follows:circumference = 2·π·radius
area = π·radius2
Project #3.2: Write a program to find the side surface area and volume of a regular cylinder. The formulas for these quantities are as follows:sideSurfaceArea = 2·π·radius·height
volume = π·radius2·height
Project #3.3: Write a program to find the circumference and area of an ellipse. The formulas for these quantities are as follows:circumference = 2·π·the square root of ( ( (height/2)2 + (width/2)2) / 2 )
area = π·(height/2)·(width/2)
Project #3.4: Write a program to find the surface area and volume of any sphere. The formulas for these quantities are as follows:surface area = 4·π·radius2
volume = (4/3)·π·radius3