Skip to content

Instantly share code, notes, and snippets.

@delucas
Created September 27, 2013 02:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save delucas/6723479 to your computer and use it in GitHub Desktop.
Save delucas/6723479 to your computer and use it in GitHub Desktop.
UNTreF - Rectángulo y Puntos
class Punto {
private double x;
private double y;
Punto(double x, double y) {
this.x = x;
this.y = y;
}
double getX() {
return this.x;
}
double getY() {
return this.y;
}
}
class Rectangulo {
private Punto p1;
private Punto p2;
Rectangulo(Punto p1, Punto p2) {
this.p1 = p1;
this.p2 = p2;
}
boolean contieneA(Punto r) {
return p1.getX() <= r.getX() && p2.getX() >= r.getX() && p1.getY() <= r.getY() && p2.getY() >= r.getY();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment