Given below is a Rectangle class consisting of an upper left coordinate and a lower right coordinate.
class Rectangle { int upperLeftX; int upperLeftY; int lowerRightX; int lowerRightY; }
Since the upper left coordinate and lower right coordinate comprise of points, how would you modify the definition of the Rectangle class to include these points in your class?
Hint: You can create a Point class to store the x and y coordinates of the upper left and lower right points and use composition to include the upper left and lower right points inside the Rectangle class, as objects of the Point class.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here