Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write C++ code for problem Problem: Suppose your math professor asks you to create a calculator to determine the volume of a cone based on

write C++ code for problem
image text in transcribed
Problem: Suppose your math professor asks you to create a calculator to determine the volume of a cone based on its height and radius. To make it more charming you decide that your program will ask the user's name before asking for the needed data to calculate the volume. You must use the formula shown below where r is the radius and h is the height of the cone. Cone The height and the radius must be whole numbers but the volume must be a double precision real number with three decimal digits. 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: Declares a global constant variable called PI that holds value 3.141592 Declares a variable named name that holds text. Declares variables named height and radius that hold whole numbers. Declares a variable named volume that holds double precision real numbers. Prompts the user "May I get your first name please?". Reads the value from the keyboard and stores it in name. Prompts the user "Thanks ". name, ". now enter height and radius of the cone please: Reads the values from the keyboard and stores them in height and radius respectively. Calculates the volume using the formula shown in the figure above Rounds the volume to the nearest thousandths (three decimal digits) and reassigns it to volume. Formats the output to display the volume in fixed format with three decimal digits. Prints a message like the one below: "Ok", name, the cone's volume is ". volume *Implement this formula exactly as it is displayed You need to define three value-returning and one void functions to implement this solution

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

The Temple Of Django Database Performance

Authors: Andrew Brookins

1st Edition

1734303700, 978-1734303704

More Books

Students also viewed these Databases questions

Question

1. Organize and support your main points

Answered: 1 week ago

Question

3. Move smoothly from point to point

Answered: 1 week ago

Question

5. Develop a strong introduction, a crucial part of all speeches

Answered: 1 week ago