##Student Name: Wurong Weng
##MacID: wengwr
##Student Number: 1224989
##Date: Mar. 27, 2013

class Vector:
    def __init__(self, a, b):
        self.x = a
        self.y = b

    def getX(self):
        return self.x

    def getY(self):
        return self.y

    def magnitude(self): #magnitude of a vector
        return (self.x**2 + self.y**2)**0.5

    def scalarMultiply(self, s): #scalar multiple of vector and s
        return Vector(self.x*s, self.y*s)

    def add(self, v): #add two vectors
        return Vector(self.x + v.getX(), self.y + v.getY())

# linear combination of two vectors and tworeal number, (a*V1)+(b*V2)
    def linearCombo(self, v, a, b): 
        return self.scalarMultiply(a).add(v.scalarMultiply(b))




##Design Question:
##    this can be implement by the following code:
##
##    def subtract(self, v): # v is a normal parameter Vector object
##        return Vector(self.x - v.getX(), self.y - V.getY())
##
##Test Plan:
##
##    Test: 1 for method magnitude, V1.magnitude()
##    Input: V1 = Vector(2,3)
##    Expected Output:3.605
##    Actual Output:3.605551275463989
##    Result: PASS
##
##    Test: 1 for method scalarMultiply, V1.scalarMultiply(s)
##    Input: V1 = Vector(2,3), s = 2
##    Expected Output: Vector(4,6)
##    Actual Output: Vector(4,6)
##    Result: PASS
##
##    Test: 1 for method add, V1.add(v)
##    Input: V1 = Vector(2,3), v = Vector(5,6)
##    Expected Output: Vector(7,9)
##    Actual Output:Vector(7,9)
##    Result: PASS
##
##    Test: 1 for method linearCombo, V1.linearCombo(v, a, b)
##    Input: V1 = Vector(2,3), v = Vector(5,2), a = 2, b =3
##    Expected Output: Vector(19,12)
##    Actual Output:Vector(19,12)
##    Result: PASS
