Create a Geometry Calculator program that calculates the circumference of a circle, the area of a circle, and the volume of a sphere with a user inputted radius. You will implement this by creating four functions: A function that gets user input for a new radius and returns the value. A function that is passed the current radius, calculates the circumference of a circle, and returns that value. A function that is passed the current radius, calculates the area of a circle, and returns that value. A function that is passed the current radius, calculates the volume of a sphere, and returns that value. A function that is passed the current radius, returns nothing but only displays the following menu: GEOMETRY CALCULATOR 1)  Input a new radius (Currently r = 1) 2)  Circumference of Circle 3)  Area of Circle 4)  Volume of Sphere 5)  Exit ________________________________ Please enter an option from the menu: Within the "main" function use a  switch statement  within a  do - while loop  to carry out the program that will call the necessary functions based upon user input. Here are some items you should consider: use the #include library for using the pow(function)  Create a global variable for pi and declare it a constant: const double pi = 3.14159; Set the initial radius variable = 1. Use a double for variables. Don't worry about giving the units like square centimeters, etc. Just give the number.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter6: User-defined Functions
Section: Chapter Questions
Problem 1TF: Mark the following statements as true or false: a. To use a predefined function in a program, you...
icon
Related questions
Question

Create a Geometry Calculator program that calculates the circumference of a circle, the area of a circle, and the volume of a sphere with a user inputted radius.

You will implement this by creating four functions:

  • A function that gets user input for a new radius and returns the value.
  • A function that is passed the current radius, calculates the circumference of a circle, and returns that value.
  • A function that is passed the current radius, calculates the area of a circle, and returns that value.
  • A function that is passed the current radius, calculates the volume of a sphere, and returns that value.
  • A function that is passed the current radius, returns nothing but only displays the following menu:

GEOMETRY CALCULATOR

1)  Input a new radius (Currently r = 1)

2)  Circumference of Circle

3)  Area of Circle

4)  Volume of Sphere

5)  Exit

________________________________

Please enter an option from the menu:

Within the "main" function use a  switch statement  within a  do - while loop  to carry out the program that will call the necessary functions based upon user input.

  • Here are some items you should consider:
    • use the #include<cmath> library for using the pow(function) 
    • Create a global variable for pi and declare it a constant:

const double pi = 3.14159;

    • Set the initial radius variable = 1.
    • Use a double for variables.
    • Don't worry about giving the units like square centimeters, etc.
      • Just give the number.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 5 images

Blurred answer
Knowledge Booster
Types of Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr