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, 23.06.2019 02:30
Three out of five seniors remain undecided about a college major at the end of their senior year.
Answers: 3
question
Computers and Technology, 24.06.2019 00:30
Afiling system in which an intermediary source of reference, such as a file card, must be consulted to locate specific files is called a(n) system. a. shelf filing b. direct filing c. indirect filing d. shingling
Answers: 1
question
Computers and Technology, 24.06.2019 04:30
How do you share someone else’s tweet with your own twitter followers?
Answers: 1
question
Computers and Technology, 24.06.2019 08:30
Formatting rows and columns is similar to cell formatting. in an openoffice calc spreadsheet, you can format data entered into rows and columns with the of the rows and columns options. you can insert rows and columns into, or delete rows and columns from, a spreadsheet. use the insert or delete rows and columns option on the insert tab. alternatively, select the row or column where you want new rows or columns to appear, right-click, and select insert only row or only column options. you can hide or show rows and columns in a spreadsheet. use the hide or show option on the format tab. for example, to hide a row, first select the row, then choose the insert tab, then select the row option, and then select hide. alternatively, you can select the row or columns, right-click, and select the hide or show option. you can adjust the height of rows and width of columns. select row and then select the height option on the format tab. similarly, select column, then select the width option on the format tab. alternatively, you can hold the mouse on the row and column divider, and drag the double arrow to the position. you can also use the autofit option on the table tab to resize rows and columns.
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, 16.12.2019 07:31
question
Spanish, 16.12.2019 07:31
question
Biology, 16.12.2019 07:31
Questions on the website: 13722367