Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Coding The volume V and surface area S of a right circular code with base radius r and height h are given by the

C++ Coding

The volume V and surface area S of a right circular code with base radius r and height h are given by the formulas:

image text in transcribed

I have started a program that reads in the height and radius, then calculates and outputs the volume and surface area. USING MY ALREADY DECLARED VARIABLES AND CONSTANTS, your job is to add required code in places marked

//Add code here

Important: Use cmath functions wherever possible. The Volume (in cubic units) should be displayed with 2-digit precision; the Surface Area (in square units) with 3-digit precision. Do NOT use something like .33 for 1/3but be careful how you write the volume formula (we'll talk about this more later in class). I will let you use the literal 2 with the function for squaring values

output for two runs: first with r = 8 and h = 12, then with r = 2.5 and h = 5.5

Here is the "starter code" //Task 4 - The volume and surface area of a right circular cone

#include #include #include using namespace std;

int main() {

const double PI = 3.14159; double radius, height; double volume, surfaceArea;

cout > radius >> height;

volume = //Add code here to calculate volume surfaceArea = //Add code here to calculate surface area

//Add code here: to ensure the output is in fixed notation and always shows the decimal point cout //Add code here to output the volume with 2-digit precision and proper units cout //Add code here to output the surface area with 3-digit precision and proper units

return 0;

}

and

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: 3

blur-text-image

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

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

9th Edition

0135188148, 978-0135188149, 9781642087611

More Books

Students also viewed these Databases questions