import math

class Point(object):
  '''Represents a point in 2-d'''
  def __init__(self, x=0.0, y=0.0):
    self.x = x
    self.y = y
  def __str__(self):
    return '(%g, %g)' % (self.x, self.y)
  def __add__(self, other):
    point = Point(self.x + other.x, self.y + other.y)
    return point
 
def print_point(p):
  print '(%g, %g)' % (p.x, p.y)

def distance(p1, p2):
  '''Returns the distance between Points p1 and p2'''
  return math.sqrt((p2.x - p1.x)**2 + (p2.y - p1.y)**2)

class Rectangle(object):
    """represent a rectangle. 
       attributes: width, height, corner.
    """

def area(rect):
   ''' returns area of the rectangle, rect'''
   return rect.width * rect.height

def find_center(box):
    ''' Returns the center of a rectangle'''
    p = Point()
    p.x = box.corner.x + box.width/2.0
    p.y = box.corner.y + box.height/2.0
    return p

zero = Point()
#print_point(zero)
one = Point(1.0,1.0)
print_point(one)

box = Rectangle()
box.width = 100.0
box.height = 200.0
box.corner = Point()
box.corner.x = 0.0
box.corner.y = 0.0

blank = Point()
blank.x = 3.0
blank.y = 4.0

origin = Point()
origin.x = 0
origin.y = 0

print 'blank = ', 
print_point(blank)
print 'origin = ', 
print_point(origin)
print 'distance between blank and origin  = ', distance(blank, origin)
print 'the box area  = ', area(box)


