Question: The Point class will have two private member variables named x and y. This class should contain two constructors: a default constructor, and an overloaded

The Point class will have two private member variables named x and y. This class should contain two constructors: a default constructor, and an overloaded constructor, which takes two arguments, and uses these to set the coordinates ofx and y. There will be setters and getters for x and y, as wl as a method named move, which move x and y with the amount specified by the arguments. There will also be a print method which prints out the coordinates as: (2, 3) for a point with coordinates (2,3). Make sure to test this with a driver file. Part 2 Write a definition of a class Rectangle using the Point class. A rectangle is specified by two comer points (bottom left and top right) The sides of the rectangle are parallel to the coordinate axes. The implementation of the class should be as follows The private data members of the class include all 4 comer points of the rectangle. There are two constructors: one takes two points as arguments and creates a rectangle with the first point as the bottom left comer and the second as the top right comer, the other (default) constructor creates a rectangle with the corners (0,0), (1,0). (0,1), (1,1) . Hint: use your setters from the class Point to set the values of the comer points. o *The print member function prints all 4 cormers of the rectangle, using the member function print of the class Point. Test the class Rectangle in main0, demonstrate that all member functions work as specified
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
