import java.util.Scanner;
public class SumaRestaVectores
{
  
  public static void main(String args[])
  {
    System.out.println("Operaciones de vectores en el plano (x,y)");
    
    boolean datoscorrectos= true;
    
    while( datoscorrectos)
    {
      System.out.println("Ingrese vector: ");
      Vector vector1= new Vector();
      datoscorrectos=vector1.leerVector();
      vector1.imprimirVector();
      System.out.println();
    }
  }
}

class Vector
{
  private double x = 0.0;
  private double y = 0.0;
  
  
  public boolean leerVector()
  { 
    Scanner teclado= new Scanner(System.in);
    System.out.print("Ingrese coordenada x: ");
    x = teclado.nextDouble();
    if(x==0) return false;
    System.out.print("Ingrese coordenada y: ");
    y= teclado.nextDouble();
    if(y==0) return false;
    return true;
    
  }
  public void imprimirVector()
  {
    System.out.print(toString());
  }
  public double cambior()
  {
    double r= Math.sqrt((x*x)+(y*y));
    return r;
  }
  
  
  public double cambioan()
  {
    double a= Math.atan2(y,x);
    return a;
  }
  public String toString()
  { 
    return String.format("(x,y)=(%.2f,%.2f);(r,a)=(%.2f,%.2f)",x,y,cambior(),cambioan());
  }
}
 
  
  
  
  
  

