Question: write C++ code for problem Problem: Suppose your geometry professor asks you to create a program that calculates the surface areas of a cube and

write C++ code for problem
write C++ code for problem Problem: Suppose your geometry professor asks you

Problem: Suppose your geometry professor asks you to create a program that calculates the surface areas of a cube and a sphere. In order to find these two values, your program needs to get the side of the cube and the radius of the sphere first and then, using them, calculate the corresponding areas using the formulas shown below. Surface area of cube: 6 x 52 Surface area of sphere: 4 x ixr? The values corresponding to s (side of the cube), r (radius of the sphere), and the calculated areas must be double precision real numbers. Your task: implement in C++ the algorithm solution shown below. Algorithm solution (in pseudocode): To solve this problem your program must perform the following tasks: Declare a global constant variable named PI that holds value 3.141592 Declare variables named side, radius, s_cube, and s_sphere that hold double precision real numbers Prompt the user to "Enter side of cube : " Read from keyboard the value entered by the user and assign it to side Prompt the user to "Enter radius of sphere : Read from keyboard the value entered by the user and assign it to radius Call cube_surf to calculate the surface area of the cube and assign the result to s_cube Call sphere_surf) to calculate the surface area of the sphere and assign the result to s_sphere Clear the screen Format the output to display the numbers in fixed format with two decimal digits Display on the screen the message "The surface of a cube of sides", side, "is", s_cube "The surface of a sphere of radius", radius," is ", s_sphere You need to define four value-returning functions to implement this solution

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!