You are on page 1of 1

class Ponto2D {

private double x;
private double y;

public Ponto2D() { x = 0;y = 0;}

public Ponto2D(double x, double y) {this.x = x;this.y = y;}

public void setX(double x) { this.x = x;}

public void setY(double y) { this.y = y;}

public double getX() { return x;}

public double getY() { return y;}

public boolean igual(Ponto2D p) {


if (x == p.getX() && y == p.getY()) {
return true;
}
else{
return false;
}
}

public boolean maior (Ponto2D p) {


if (x>p.getX()){
return true;
}
else{
if (x<p.getX()){
return false;
}
else{
if (y>p.getY()){
return true;
}
else{
return false;
}
}
public boolean menor (Ponto2D p) {
if (x<p.getX())
return true;
}
else{
if (x>p.getX())
return false;
}
else{
if (y<p.getY())
return true;
}
else{
return false;
}
}
}

You might also like