public class Rect { private int myX; private int myY; /** * Answers a Rect object with upper left corner at * (x,y) * * @param int x upperleft corner of the rectangle * int y upperleft corner of the rectangle **/ public Rect(int x, int y) { myX = x; myY = y;} /* Answers true if a point (x,y) is within this Rect * Otherwise false. * @param int x the x-coordinate * int y the y-coordinate * @return true if (x,y) is within this Rec * false otherwise */ public boolean isContained(int x, int y) { return (x >= myX && x <= myX+130 && y >= myY && y <= myY+80) ; } /** Answers x coordinate of upperleft corner * @return x coordinate of upperleft corner of this Rect **/ public int getX() {return myX;} /** Answers y coordinate of upperleft corner * @return y coordinate of upperleft corner of this Rect **/ public int getY() {return myY;} }