contains method
Checks if a point (px, py) is contained within this rectangle
Mathematical Operation: Point containment test using simple inequalities: px must be between x (left) and x+width (right) py must be between y (top) and y+height (bottom)
Implementation
bool contains(double px, double py) {
return px >= x && px <= x + width && py >= y && py <= y + height;
}