import java.util.*;
public class Point
{
private int x;
private int y;
public Point(int x, int y)
{
this.setX(x);
this.setY(y);
}
public double getX()
{
return x;
}
public void setX(int x)
{
this.x = x;
}
public double getY()
{
return y;
}
public void setY(int y)
{
this.y = y;
}
public String tior()
{
return "x= " + this.x + "\n" + "y= " + this.y;
}
/////////////////////////////////////////////////////////
static Scanner in = new Scanner(System.in);
public static void main (String []args)
{
System.out.println("Enter two coordination sets (x y ,x y)");
Point p1 = new Point(in.nextInt(),in.nextInt());
Point p2 = new Point(in.nextInt(),in.nextInt());
System.out.println("Point #1: " + "\n" + p1.tior() + "\n" + "Point #2 " + "\n" + p2.tior());
if (p1.getX() == p2.getX() && p1.getY() == p2.getY())
{
System.out.println("Both points are exactly equal");
return;
}
if (p1.getY() == p2.getY())
{
System.out.println("Both points are on the exact same Y axis");
return;
}
if (p1.getX() == p2.getX())
{
System.out.println("Both points are on the exact same X axis");
return;
}
if (p1.getX() != p2.getX() && p1.getY() != p2.getY())
{
System.out.println("Both points have no connection");
return;
}
}
}
Comments