# Programmer: Sriram Pemmaraju
# Date: April 24, 2012
import math

# Definition of the point class
class point():

    # This is the initializing method or constructor for the class.
    # Most classes will have one or more constructor methods.
    # Examples: p = point(5, 7) will call this method to construct
    # an instance p of the point class.
    def __init__(self, a, b):
        self.x = a
        self.y = b

    # This translates the point horizontally by a units.
    # This is called as: p.translateX(20)
    def translateX(self, a):
        self.x = self.x + a

    # This translates the point vertically by a units.
    # This is called as: p.translateY(-10)
    def translateY(self, a):
        self.y = self.y + a

    # This returns the Euclidean distance between current point 
    # and the point given as an argument.
    # This is called as: p.distance(point(10, 15))
    def distance(self, p):
        return math.sqrt((self.x - p.x)**2 + (self.y - p.y)**2)


    def __repr__(self):
        return "(" + str(self.x) + ", " + str(self.y) + ")"
    
    def __add__(self, other):
        return point(self.x + other.x, self.y + other.y)
    
    def __mul__(self, other):
        return self.x*other.x + self.y*other.y
