Question: C++ only and no header files Define the Rectangle2D class that contains: - Two double data fields named x and y that specify the center

C++ only and no header files C++ only and no header files Define the Rectangle2D class that contains:

Define the Rectangle2D class that contains: - Two double data fields named x and y that specify the center of the rectangle with constant get functions and set functions. (Assume that the rectangle sides are parallel to x-or y-axes.) - The double data fields width and height with constant get functions and set functions. - 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 constant function contains(double x, double y ) that returns true if the specified point (x,y) is inside this rectangle. See Figure a. - A constant function contains(const Rectangle2D \&r) that returns true if the specified rectangle is inside this rectangle. See Figure b. - A constant function overlaps(const Rectangle2D \&r) that returns true if the specified rectangle overlaps with this rectangle. See Figure c. (a) (b) (v) - Write a test program that creates three Rectangle2D objects r1(2,2,5.5,4.9),r2(4,5, 10.5,3.2), and r3(3,5,2.3,5.4), and displays the result of r1.contains (3,3), r1.contains(r2), and r1 overlaps(r3)

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!