Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a complete C++ console mode program (#includes, etc., but no prologue) to

ID: 1929048 • Letter: W

Question

Write a complete C++ console mode program (#includes, etc., but no prologue) to ask the user to enter the radius (any positive real number) of a circle. Your program should display the area of a circle with that radius, and the volume of a sphere with that radius. (area = PI * radius2 and volume = PI * 4/3 * radius3 ). The result should be displayed with accuracy to 3 decimal digits (ie. 1.234). Make sure you include all the header files needed to support the operations you use.

a. Use appropriate data types.
b. Make the value of PI (3.14159) a constant in your program.
c. Valid input is any positive real number and zero. If the user input is negative, your program should print an error message and not try to compute any results.
d. Be sure to display explanatory text to make the input and output clear to the user. (Points : 15)

Explanation / Answer

/*Write a complete C++ console mode program (#includes, etc., but no prologue) to ask the user to enter the radius (any positive real number) of a circle. Your program should display the area of a circle with that radius, and the volume of a sphere with that radius. (area = PI * radius2 and volume = PI * 4/3 * radius3 ). The result should be displayed with accuracy to 3 decimal digits (ie. 1.234). Make sure you include all the header files needed to support the operations you use. a. Use appropriate data types. b. Make the value of PI (3.14159) a constant in your program. c. Valid input is any positive real number and zero. If the user input is negative, your program should print an error message and not try to compute any results. d. Be sure to display explanatory text to make the input and output clear to the user. (Points : 15) */ #include #include #include using namespace std; int main(){ const float PI=3.14159; float area,volume,radius; char wait; // while(1){ coutradius; if (radius
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote