Question: Here, you will be implementing the MyRectangle2D class, which models a 2D rectangle with x, y coordinates, width and height. It contains: 3 private instance

Here, you will be implementing the MyRectangle2D class, which models a 2D rectangle with x, y coordinates, width and height. It contains: 3 private instance variables: topLeft (of type java.awt.Point), width (of type int, default-10) and height (of type int, default=10) A default constructor that constructs a rectangle with default values: Point (0,0), width-10 and height-10, An overloaded constructor that constructs a rectangle with the given point instance. An overloaded constructor that constructs a rectangle with the given width and height values. An overloaded constructor that constructs a rectangle with the given Point instance, width and height values. A tostring() method that returns a string description of the instance in the format "(x, y), width x height" Getter and setter for the instance variables x, y, width and height. Write the MyRectangle2D class in the answer box below. (Remove the "public" keyword when you insert your code.) Note - keep a copy of your solution to this task because you will be extending it step by step in subsequent tasks. For example: Test Result MyRectangle2D r- new MyRectangle2DO;C0, 0), 10 x 10 System.out.println(r)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
