(In Python 3) For this assignment, you would use a menu driven option to calculate the volume and surface area of cylinder as well as a cone using functions. Use the cylinder_volume(r, h) and the cylinder_surface_area(r, h) from Week 9 lab and expand your code to also calculate the surface area and the volume of the cone using functions. Your tasks are as follows: Define a function called cone_volume(r, h) that that takes two arguments from user: radius r and height h, and prints the volume rounded to two decimal places (no need to return the value). Define a function called cone_surface_area(r, l) that takes two arguments from user: radius r and slant height l, and prints the surface area of the cone rounded to two decimal places (no need to return the value). Display a menu to ask the user to input their choice. Based on the choice selected, ask the user for corresponding input for r,h, and/or l. Inputs need to be float. Hint: you can input the values inside the if statements when comparing the options with the user's choice for the menu. Use default parameter values for all the functions of your choice. Formulae: Volume of a cone: 13πr2h13πr2h Surface Area of a cone: πrl+πr2πrl+πr2 Volume of a cylinder: πr2hπr2h Surface Area of a cylinder 2πr2+2πrh2πr2+2πrh A sample run is show below: **** Menu **** 1. Volume of a Cone 2. Surface of a Cone 3. Volume of a Cylinder 4. Surface of a Cylinder 5. Quit Enter your choice (1-5): 1 Enter radius: 22.5 Enter height: 10.5 Volume of the cone for radius 22.5 and height 10.5 is: 5566.51 **** Menu **** 1. Volume of a Cone 2. Surface of a Cone 3. Volume of a Cylinder 4. Surface of a Cylinder 5. Quit Enter your choice (1-5): 7 Wrong choice entered. **** Menu **** 1. Volume of a Cone 2. Surface of a Cone 3. Volume of a Cylinder 4. Surface of a Cylinder 5. Quit Enter your choice (1-5): 5 Goodbye!

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

(In Python 3)

For this assignment, you would use a menu driven option to calculate the volume and surface area of cylinder as well as a cone using functions.

Use the cylinder_volume(r, h) and the cylinder_surface_area(r, h) from Week 9 lab and expand your code to also calculate the surface area and the volume of the cone using functions.

Your tasks are as follows:

  1. Define a function called cone_volume(r, h) that that takes two arguments from user: radius r and height h, and prints the volume rounded to two decimal places (no need to return the value).
  2. Define a function called cone_surface_area(r, l) that takes two arguments from user: radius r and slant height l, and prints the surface area of the cone rounded to two decimal places (no need to return the value).
  3. Display a menu to ask the user to input their choice. Based on the choice selected, ask the user for corresponding input for r,h, and/or l. Inputs need to be floatHint: you can input the values inside the if statements when comparing the options with the user's choice for the menu.
  4. Use default parameter values for all the functions of your choice.

Formulae:

Volume of a cone: 13πr2h13πr2h

Surface Area of a cone: πrl+πr2πrl+πr2

Volume of a cylinder: πr2hπr2h

Surface Area of a cylinder 2πr2+2πrh2πr2+2πrh

A sample run is show below:

**** Menu **** 1. Volume of a Cone 2. Surface of a Cone 3. Volume of a Cylinder 4. Surface of a Cylinder 5. Quit Enter your choice (1-5): 1 Enter radius: 22.5 Enter height: 10.5 Volume of the cone for radius 22.5 and height 10.5 is: 5566.51 **** Menu **** 1. Volume of a Cone 2. Surface of a Cone 3. Volume of a Cylinder 4. Surface of a Cylinder 5. Quit Enter your choice (1-5): 7 Wrong choice entered. **** Menu **** 1. Volume of a Cone 2. Surface of a Cone 3. Volume of a Cylinder 4. Surface of a Cylinder 5. Quit Enter your choice (1-5): 5 Goodbye!

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Literals
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