Question: ( Geometry: the MyRectang 1 e 2 D class ) Define the MyRectang 1 2 2 D class that contains: Two doub 1 e data

(Geometry: the MyRectang1 e2D class) Define the MyRectang122D class that contains:
Two doub1e data fields named x and y that specify the center of the rectangle with getter and setter methods. (Assume the rectangle sides are parallel to x- or y-axis.)
The data fields width and height with getter and setter methods.
A no-arg constructor that creates a default rectangle with (0,0) for (x,y) and 1 for both width and height.
A constructor that creates a rectangle with the specified x,y, width, and height.
A method getArea () that returns the area of the rectangle.
A method getPerimeter () that returns the perimeter of the rectangle.
A method contains(double x, double y) that returns true if the specified point (x,y) is inside this rectangle (see Figure 10.24a).
A method contains (MyRectang1e2D r) that returns true if the specified rectangle is inside this rectangle (see Figure 10.24b).
A method overlaps (MyRectang1e2D r) that returns true if the specified rectangle overlaps with this rectangle (see Figure 10.24 c).
 (Geometry: the MyRectang1 e2D class) Define the MyRectang122D class that contains:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!