import javax.swing.*;

public class cartesian
{
double x,y;
//constructor methods
public cartesian()
{x=0;y=0;}

public cartesian(double xi,double yi)
{x=xi;y=yi;}

public cartesian(cartesian A)
{x=A.x;y=A.y;}

public void read_cartesian(double xi,double yi)
{x=xi;y=yi;}
//calcula
public void add(cartesian B)
{x+=B.x;y+=B.y;}

public void substract(cartesian B)
{x-=B.x;y-=B.y;}

public static cartesian add(cartesian A,cartesian B)
{cartesian C=new cartesian(A);
 C.add(B);
 return C;
}
public static cartesian substract(cartesian A,cartesian B)
{cartesian C=new cartesian(A);
 C.substract(B);
 return C;
}

public boolean equals(cartesian A)
{boolean b=false;
if(x==A.x && y==A.y) b=true;
return b;
}
 
public String toString()
{String s1=" x = "+x+" y = "+y;
return s1;} 

public static void outputwindow(String s)
{
String s1="cartesian class output string";	
JOptionPane.showMessageDialog(null,s,s1, JOptionPane.PLAIN_MESSAGE);	
}
 
}