Skip to content

Instantly share code, notes, and snippets.

@jonathan-irvin
Created April 16, 2015 19:44
Show Gist options
  • Save jonathan-irvin/edaf8cc413a3befa2880 to your computer and use it in GitHub Desktop.
Save jonathan-irvin/edaf8cc413a3befa2880 to your computer and use it in GitHub Desktop.
Vector
public class Vector {
private double x;
private double y;
public Vector (double x, double y){
this.x = x;
this.y = y;
}
public double getX () {
return x;
}
public double getY () {
return y;
}
public void setX (double newX) {
x = newX;
}
public void setY (double newY) {
y = newY;
}
public double getLength() {
double length = Math.sqrt(x*x + y*y);
return length;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment