Project 27: Unit Vectors
Intro Problem: Suppose you leave your house and walk 6 miles west and 2 miles south to a park.
What direction is the park (in degrees) from your house?
When we are only concerned with the direction of a vector, oftentimes we will use something called a unit vector (which means it has magnitude 1)
A Unit Vector (or directional vector) is a vector with magnitude 1. It is helpful when we are most concerned with the direction of a vector. A Unit vector with the same direction as the vector above would be <-6/sqrt(40), -2/sqrt(40)> or <-.9487, -.3162>.
Project 27: Variables x and y have been initialized. These variables represent the x-y components of a vector.
Task: Appropriately initialize the values 'unitX' and 'unitY' which represent a unit vector with the same direction as the vector given.
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 in a row, you can enter your e-mail address.