Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Python write functions: def sphereVolume ( r ) def sphereSurface ( r ) def cylinderVolume ( r , h ) def cylinderSurface ( r

In Python write functions:
def sphereVolume(r)
def sphereSurface(r)
def cylinderVolume(r, h)
def cylinderSurface(r, h)
def coneVolume(r, h)
def coneSurface(r, h)
that compute the volume and surface area of a sphere with radius r, a cylinder with a circular base with radius r and height h, and a cone with a circular base with radius r and height h. You will need to use the pi and sqrt() functions from the math library. Then, write a program that prompts the user for the values of r and h, calls the six functions, and prints the results.
The formulas are
volume of a sphere
V=4
3
\pi
r3
surface area of a sphere
A=4
\pi
r2
volume of a cylinder
V=\pi
r2
h
surface area of a cylinder
A=2
\pi
r
h+2
\pi
r2
volume of a cone
V=\pi
r2
h
3
surface area of a cone
look this up on Google
The input and out should look like this (the user entered numbers are in bold for example only):
Enter the radius: 4.5
Enter the height: 6.5
A sphere has volume: 381.7035074111598
A sphere has surface area: 254.46900494077323
A cylinder has volume: 413.5121330287565
A cylinder has surface area: 311.0176727053895
A cone has volume: 137.83737767625217
A cone has surface area: 175.38136922539945

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 Design And Implementation

Authors: Edward Sciore

2nd Edition

3030338355, 978-3030338350

More Books

Students also viewed these Databases questions