Question

In: Computer Science

Write a C++ program to calculate the sphere volume and surface area. Provided that the sphere...

Write a C++ program to calculate the sphere volume and surface area. Provided
that the sphere volume = and the sphere surface area = , where r is the radius.
1. Read r from the user using cin statement.
2. Calculate the volume (Vol) and the surface area (Area) of a sphere.
3. Print r, Vol, and Area in a suitable messages.

Solutions

Expert Solution

#include<bits/stdc++.h>
using namespace std;
int main()
{
   //declare the variable
   double r,Area,Vol;
   //calculate the pi value
   double pi = 2*acos(0.0);
   //prompt message for the user
   cout<<"Enter the radius : ";
   //take input from the user
   cin>>r;
   //calculate volume of sphere
   Vol = 4*pi*pow(r,3)/3;
   //surface area of sphere
   Area = 4*pi*pow(r,2);
   //print the volume
   cout<<"The sphere volume = "<<Vol;
   //print the surface area
   cout<<" and the sphere surface area = "<<Area;
   //print the radius
   cout<<", where "<<r<<" is the radius.";
}

If you have any problem then let me know in comment box and if you like then please rate or give a big thumbs up thank you.


Related Solutions

1) Write a functional program in Java that can calculate the volume and surface area of...
1) Write a functional program in Java that can calculate the volume and surface area of a sphere and a cube 2) Write a procedural program in Java that can calculate the volume and surface area of a sphere and a cube 3) Write an Object Oriented Program in Java that can find the volume and surface area of a sphere and cube
Write a program in C++ that solves this problem Calculate the area and volume of a...
Write a program in C++ that solves this problem Calculate the area and volume of a sphere problem. Inside a for loop, vary the radius from 10 to 40  with a step or increment of 5 and calculate the area and volume Your radius will be equal to your loop counter. All calculations should have 2 decimal places, but the radius should have zero decimal places and any number of 1,000 or more should have a comma. Print the radius, area,...
Part One: Write an interactive program to calculate the volume and surface area of a three-dimensional...
Part One: Write an interactive program to calculate the volume and surface area of a three-dimensional object. Use the following guidelines to write your program: Create a word problem that involves calculating the volume and surface area of a three-dimensional object. Choose one of the following: Cube: surface area 6 s2 , volume s3 Sphere: surface area 4πr2 , volume (4.0/3.0) π r3 Cylinder: surface area 2π r2 + 2 π r h, volume π r2 h Cone: surface area...
Write a C++ program for the following problem: Calculate and print the area and volume of...
Write a C++ program for the following problem: Calculate and print the area and volume of a cone inside a While  loop that goes from 1 to 20 with a step of .5. (the step is 1/2 or Point 5, so you go 10, 10.5,11, 11.5) Note: Your loop variable will need to be a double data type Use two decimal places on all numbers that are double data type. This will be a table with 3 columns. Don't worry about...
Write a program that reads the radius of a sphere and calculates it's volume and surface...
Write a program that reads the radius of a sphere and calculates it's volume and surface area. Format results to 4 decimal places. The radius=3.2 Your program should output volume and surface area.  Repeat same steps for program2, but this time use the following input values: a= ꟷ2.4 , b = 4.5 . Your program should output sum, Fun1, and Fun2. It's for C++
Write a JavaScript function to calculate the surface area of a sphere. Input the radius using...
Write a JavaScript function to calculate the surface area of a sphere. Input the radius using a NumericUpDown. Have the function calculate the surface area and display it on your page. Label the inputs and the output on your page. Change the title to "Oh, Boy! JavaScript!". Put your name at the top in camelCase. Put your major at the bottom in camelCase.
Write most basic C++ program possible that calculates volume and surface area of five shapes (Cube,...
Write most basic C++ program possible that calculates volume and surface area of five shapes (Cube, Sphere, Prism, Cylinder, Cone), where each shape has its own class (with a volume function, surface area function, constructor, as well as get and set functions), and the shape dimensions are private class members. Include input and display functions.
The surface area of a sphere of radius r is S = 4πr2. Its volume is
The surface area of a sphere of radius r is S = 4πr2. Its volume is V = 4πr3/3. a. Use MuPAD to find the expression for dS/dV. b. A spherical balloon expands as air is pumped into it. What is the rate of increase in the balloon’s surface area with volume when its volume is 30 in.3?
A sphere of radius r has surface area A = 4πr2 and volume V = 4...
A sphere of radius r has surface area A = 4πr2 and volume V = 4 3 πr3. The radius of sphere 2 is triple the radius of sphere 1. (a)What is the ratio of the areas, A2/A1? (b) What is the ratio of the volumes, V2/V1?
know the mathematical relationship between surface area and volume, and explain how surface to area volume...
know the mathematical relationship between surface area and volume, and explain how surface to area volume affects heat loss. Which can be smaller endotherms or ectotherms  
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT