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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education