// Name: // Lab Section: // Primary TA: // Email: // Date: // CS101 Lab 2 // DirectionVector.java // Summary of your activity in this file: // Fill in the constructor // Add fields // Fill in the accessor methods // Fill in the other methods public class DirectionVector { private int x,y; public DirectionVector(int x, int y) { this.x = x; this.y = y; } public DirectionVector(double x, double y) { this((int)x, (int)y); } public DirectionVector add(DirectionVector addend) { return(new DirectionVector(this.x + addend.x, this.y + addend.y)); } public int getX() { return x; } public int getY() { return y; } public double magnitude() { return (Math.sqrt( x*x + y*y )); } public String toString() { return("("+x+","+y+")"); } }