This question is for the programming language C++. Thankyou!
Program: Write a program that will manipulate Rectangle objectsfor which you will create a Rectangle class.
Declare a Rectangle class in a “.h” file with attributes andmethods in the following points. Attributes should be private,methods should be generally public.
Define the Rectangle class in a “.cpp” file. Do not defineanything inline in the “.h” file. Do not use ‘namespace std’ ineither the .h or .cpp file of the class.
To use this class, write your main such that it will ask theuser to input the two points and name for two rectangles. It willthen calculate the result of the addition and subtractionoperations. Then it will output the details of all 4 rectangles -to both screen and an output file. Allow the user to keep runningthe program in a loop, if desired.
A Rectangle is made up of two points (x.y) such that the firstpoint (x1,y1) is the bottom left hand corner and second point(x2,y2) is the upper right hand corner. This will allow theRectangle to be parallel to both axes.
Add a name attribute to the Rectangle which can be printed outfrom the program. Write two methods that return the area andperimeter of the rectangle respectively. Overload the inputoperator (>>) in the class to accept input for your class asneeded. Do not use the cin operator in your class. Overload theoutput operator (<<) in the class such that it prints thefollowing for a Rectangle object with name Rect1 (without thebullet points):
Rect1’s four corners are at (5,3), (5,10), (8,10), (8,3).
Rect1’s area is 21 and perimeter is 20.
Overload the addition operator (+) as a class member such thatit returns the smalllest rectangle that will contain all fourcorners of both rectangles being added.
Overload the subtraction operator (-) as a friend function suchthat it returns a rectangle that is formed by the overlap of thetwo rectangles.
If there is no overlap between the two rectangles, it shouldreturn a rectangle where all four corners are at (0,0).
I do not understand the previous expert’s comment of “dff”. I amcontinuing to update this question in the hope that the expert willplease inform me what information is needed so that a solution canbe made.
Expert Answer
Answer to This question is for the programming language C++. Thank you! Program: Write a program that will manipulate Rectangle ob…