Project 84: Resultant Vectors

Intro Problem:  Suppose you are paddling in a boat.  You are paddling (absent of the current) at 5.099 mph at a direction of 78.69 degrees.  However, the current of the river is moving 6.708 mph at a direction of 26.57 degrees.


How fast and at what direction are you actually traveling with your paddling and the current combined?

Suppose vector u has magnitude 5.099 with direction 78.69 degrees.  Vector v has magnitude 6.708 with direction 26.57  degrees.  What is the magnitude of and direction of the resultant vector (u + v)?


u = <1, 5>

v = <6, 3>


Resultant vector is <7, 8> which has magnitude 10.247 and direction 48.81 degrees.


Project 84: Variables 'mag1', 'dir1', 'mag2', 'dir2' have been initialized.  There are working methods getMagnitude, getDirection, getXComponent, getYComponent

mag1 and dir1 are the magnitude and direction of the first vector (u)

mag2 and dir2 are the magnitude and direction of the second vector (v)

getMagnitude(x,y) returns the magnitude of the vector <x, y>

getDirection(x,y) returns the direction of the vector <x, y>

getXComponent(mag, dir) returns the x-component of the vector with magnitude and direction given

getYComponent(mag, dir) returns the y-component of the vector with magnitude and direction given

Task: Appropriately initialize the values for 'resultantMag' and 'resultantDir' which represent the magnitude and direction of the resultant vector.


Note: The following trig methods are available.

cosine(x) 

sine(x) 

tangent(x) 

cosineInverse(x)

sineInverse(x)

tangentInverse(x)

**If your code works for 5 test cases, you can enter your e-mail address

Universal Computational Math Methods:

pow(5,2) returns 25.0

abs(-3.0) returns 3

sqrt(49.0) returns 7.0