Question: 1. Declare a class Rectangle (rectangle.h file) with four private data members: x and y of type int (center of rectangle) and width and height

 1. Declare a class Rectangle (rectangle.h file) with four private data

1. Declare a class Rectangle (rectangle.h file) with four private data members: x and y of type int (center of rectangle) and width and height of double type. Include the following public member functions one default constructor without parameters, one constructor initializer (use initialization list in implementation file) four get functions (use pointer this in implementation file) one set function with four parameters (use pointer this in implementation file function area function distance (from O(0,0) to the center of the rectangle) function distanceR between the centers of two rectangles function print (use pointer this in implementation file For all member functions use minimum number of parameters and follow the requirements in red when writing definitions in the implementation (cpp) file. Keep the function names as they are given above. Do not use friend functions. (25 points) 2. Write implementation file (rectangle.cpp). Include the definitions of the above member (25 points) 3. Declare and define the following non-member functions: function areaR, function distanceR (from O (0, 0) to the center of the rectangle), function distanceRR between the centers of two rectangles. (25 points) 4. In main) Create two objects (obj1 and obj2) of class Rectangle (use two different constructors) and declare two pointers named a and b to class Rectangle Declare a pointer d to and use it to dynamically allocate a memory for an array of two Rectangle objects; Use the pointers a, b and d and implement set function with them for all of the objects (objl, obj2 and dynamically created array). . . Use objects and pointers to implement all member and non-member functions (25 points)

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!