Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1) [25 points] Youve been hired by Sphere Calculator to write a function that uses the global declaration of constant PI, const double PI =

1) [25 points] Youve been hired by Sphere Calculator to write a function that uses the global declaration of constant PI, const double PI = 3.1419;, which stores the value of p and accomplishes the following:

Prompt the user to input the value of a double variable r in unit of meters, which stores

the radius of a sphere. Use this variable as the parameter of functions that can accomplish the following:

function i. The value of A = 4r2, the surface area of the sphere. Return A then print it to the console in the main function.

Function ii. The value of V = (4/3)r3, the volume of the sphere. Return V then print it to the console in the main function.

Do NOT use using namespace std;, you need to use scope resolution operator to finish this lab assignment. The output should look like this:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions