Please send questions to st10@humboldt.edu .
#-----
# functions from Week 2 Lecture (lect02.py),
#    now with design recipe pieces added
#
# by: Sharon M. Tuttle
# last modified: 1-29-07, after lecture
#-----

# remember, this is a python comment;
# everything from a # to the end of the line is
#    IGNORED in Python...

# contract : rect_area : number number -> number
# purpose: to determine the area of a rectangle
#          whose length is <length> and whose
#          width is <width>
# example: rect_area(3, 5) should return 15

def rect_area (length, width):
    return length * width

# Tests 
print "Testing rect_area" 
print rect_area(3, 5) 
print "   should return 15"
print "--------------------------"


# contract : square_area : number -> number
# purpose: to determine the area of square
#          whose sides are of length <length>
# example: square_area(5) should return 25

def square_area(length):
    return length * length

# Tests 
print "Testing square_area" 
print square_area(5)
print "   should return 25"
print "--------------------------"


# contract : circle_area : number -> number
# purpose: determine the area of a circular disk
#          whose radius is <radius>
# example: circle_area(5) should return 78.53975

def circle_area ( radius ):
    return 3.14159 * (radius * radius)

# Tests 
print "Testing circle_area" 
print circle_area(5)
print "   should return 78.53975"
print "--------------------------"


# contract : ring_area : number number -> number
# purpose: determine the area of a ring whose outer
#          radius is <outer_radius> and whose "hole"
#          has radius <inner_radius>
# example: ring_area(10, 5) should return 235.61925

def ring_area (outer_radius, inner_radius):
    return circle_area(outer_radius) -  circle_area(inner_radius)

# Tests 
print "Testing ring_area" 
print ring_area(10, 5)
print "   should return 235.61925"
print "--------------------------"