Public feed
#726322
def instructions():
print "This Program allows one to calculate the cost of producing an open top cylinder. "
def userinput ():
d = float( raw_input( "Cylinder the diameter of the base of the cyclinder(cm): " ).strip() )
h = float( raw_input( "Cylinder height (cm): " ).strip() )
p = float( raw_input( "Price per (cm^2): ").strip() )
a = float( raw_input( "Number of units: ").strip() )
return d, h, p, a
def surfacearea(r, h):
import math
SA = (math.pi * r * r ) + (2 * math.pi * r * h )
return SA
def output(SA, p, a):
unitprice = SA * p
order = unitprice * a
return unitprice, order
instructions()
d, h, p, a = userinput()
r = d / 2
sa = surfacearea (r,h)
unitprice, order = output(sa, p, a)
print (" The cylinder has a surface area of %.2f cm^2 and a cost of %.2f to produce %f units") % sa, unitprice, order