subject

Write a program that will manipulate Rectangle objects for which you will create a Rectangle class.

Declare a Rectangle class in a ".h" file with attributes and methods in the following points. Attributes should be private, methods should be generally public.

Define the Rectangle class in a ".cpp" file. Do not define anything inline in the ".h" file. Do not use 'namespace std' in either the .h or .cpp file of the class.

To use this class, write your main such that it will ask the user to input the two points and name for two rectangles. It will then calculate the result of the addition and subtraction operations. Then it will output the details of all 4 rectangles - to both screen and an output file. Allow the user to keep running the program in a loop, if desired.

A Rectangle is made up of two points (x. y) such that the first point (x1,y1) is the bottom left hand corner and second point (x2,y2) is the upper right hand corner. This will allow the Rectangle to be parallel to both axes.

Add a name attribute to the Rectangle which can be printed out from the program. Write two methods that return the area and perimeter of the rectangle respectively. Overload the input operator (>>) in the class to accept input for your class as needed. Do not use the cin operator in your class. Overload the output operator (<<) in the class such that it prints the following for a Rectangle object with name Rect1 (without the bullet 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 that it returns the smalllest rectangle that will contain all four corners of both rectangles being added.

Overload the subtraction operator (-) as a friend function such that it returns a rectangle that is formed by the overlap of the two rectangles.

If there is no overlap between the two rectangles, it should return a rectangle where all four corners are at (0,0).

I do not understand the previous expert's comment of "dff". I am continuing to update this question in the hope that the expert will please inform me what information is needed so that a solution can be made.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 20:30
Write 150 words on what kind of website would you like to make in the future? what sites would you like to model yours after?
Answers: 2
question
Computers and Technology, 23.06.2019 12:00
What type of slide show is a dynamic and eye-catching way to familiarize potential customers with what your company has to offer? a. ole b. photo album c. brochure d. office clipboard
Answers: 2
question
Computers and Technology, 24.06.2019 06:30
Some peer-to-peer networks have a server and some don't. true false
Answers: 2
question
Computers and Technology, 24.06.2019 19:30
Dtp allows you to manipulate text boxes in the following ways. more than 1 answer. a.move them b.rotate them c.resize them d.all of the above e.none of the above
Answers: 1
You know the right answer?
Write a program that will manipulate Rectangle objects for which you will create a Rectangle class.<...
Questions
question
History, 05.10.2019 07:00
Questions on the website: 13722367