Question: Write a program that defines the named constant PI, const double PI = 3.14159;, which stores the value of . The program should use PI

Write a program that defines the named constant PI, const double PI = 3.14159;, which stores the value of . The program should use PI and the functions listed in Table 6-1 to accomplish the following:

  • Output the value of .
  • Prompt the user to input the value of a double variable r, which stores the radius of a sphere. The program then outputs the following:
    • The value of 4.0r, which is the surface area of the sphere.
    • The value of (4.0/3.0)r, which is the volume of the sphere.

You should format your output like the following example:

Surface area of the sphere: 4 * PI * 5.00 ^ 2 = 314.16 Volume of the sphere: 4 / 3 * PI * 5.00 ^ 3 = 523.60

Write a program that defines the named constant PI, const double PIYour output must match the wording precisely to earn full credit. Format your output with setprecision(2) to ensure the proper number of decimals for testing!

if I can copy paste it would be better.

Result int (double) double double double double Parameter(s) Function Header File Purpose Type abs(x) Returns the absolute value of its int argument: abs (-7) - 7 (double) ceil(x) Returns the smallest whole number that is not less than double x.ceil(56.34) - 57.0 cos(x) Returns the cosine of angle double x.cos(0.0) - 1.0 (radiana) exp(x) Returns e*, where e = 2.718: exp(1.0) - double 2.71828 fabs(x) Returns the absolute value of its double argument: fabs(-5.67) -5.67 floor (x) Returns the largest whole double number that is not greater than xfloor (45.67) - 45.00 islower (*) Returns true if x is a lowercase letter, otherwise it returns false; islower('h') is true isupper (x) Returns true if x is a int uppercase letter, otherwise it returns false; isupper('K') is true pow(x, y) Returns XY; If x is negative, double y must be a whole number: pow (0.16, 0.5) - 0.4 sqrt(x) Returns the nonnegative double square root of x, x must be nonnegative: sqrt(4.0) -2.0 double int int int double double int int tolower (x) Returns the lowercase value of xif x is uppercase; otherwise retums x toupper (x) int int Returns the uppercase value of xif x is lowercase; otherwise, returns x

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!