import java.lang.Math;

public class Vector {

	double Length;
	double Angle;
	public double getLength() {
		return Length;
	}
	public void setLength(double length) {
		Length = length;
	}
	public double getAngle() {
		return Angle;
	}
	public void setAngle(double angle) {
		Angle = angle;
	}
	
	public Vector ()
	{
		Length = 0;
		Angle = 0;
	}
	public Vector (double length, double angle)
	{
		Length = length;
		Angle = angle;
	}
	
	public double getX()
	{
		return Length * Math.cos(Angle);
	}
	public double getY()
	{
		return Length * Math.sin(Angle);
	}
	public void setCoordinates (double x, double y)
	{
		// 2 Alternative
		setLength(Math.sqrt(x*x+y*y));
		setLength(Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)));
		
		// 
		setAngle (Math.atan(y/x));
	}
	public void add (Vector other)
	{
		setCoordinates (
				getX() + other.getX(),
				getY() + other.getY());
	}
	public void sub (Vector other)
	{
		setCoordinates (
				getX() - other.getX(),
				getY() - other.getY());
	}

	public void set (double length, double angle)
	{
		Length = length;
		Angle = angle;
	}
	public void set (Vector other)
	{
		setLength (other.getLength());
		setAngle (other.getAngle());
	}
	
	
}
