Created
September 27, 2013 02:38
-
-
Save delucas/6723479 to your computer and use it in GitHub Desktop.
UNTreF - Rectángulo y Puntos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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