Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program, circle.cpp , that inputs double radius of circle. It should print for given this radius, the circumference of the circle, the area

Write a program, circle.cpp, that inputs double radius of circle. It should print for given this radius, the circumference of the circle, the area of the circle, the surface area of a sphere with that radius and the area of a sphere with that radius. Here are the formulas for computation:

Circumference = 2 ? r

Circle Area = ? r

Sphere Surface Area = 4 ? r2

Sphere Volume = 4/3 ? r

Define a constant for ? before main in your program:

const double pi = 3.14159265358;

You are required to write functions that do the following:

compute and return the circumference of a circle given the radius (parameter)

compute and return the area of a circle given the radius (parameter)

compute and return the sphere surface area given the radius (parameter)

compute and return the sphere area given the radius (parameter)

print the results given the values of the circumference, area, surface, and volume (four parameters, no return value)

A sample run might be (user input in bold):

Enter a radius: 7.5

Circumference .... 47.124

Circle Area ...... 176.715

Sphere Surface ... 706.858

Sphere Volume .... 1767.146

The output should follow the format shown above (values printed with 3 digits after the decimal, in a field width of 10 characters).

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 Processing Fundamentals Design

Authors: Marion Donnie Dutton Don F. Seaman

14th Edition Globel Edition

1292107634, 978-1292107639

More Books

Students also viewed these Databases questions