Computers and Technology

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.

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 01:00, kmsg2000
Program description: a c# app is to be created to produce morse code. the morse code assigns a series of dots and dashes to each letter of the alphabet, each digit, and a few special characters (such as period, comma, colon, and semicolon). in sound-oriented systems, the dot represents a short sound and the dash represents a long sound. separation between words is indicated by a space, or, quite simply, the absence of a dot or dash. in a sound-oriented system, a space is indicated by a short period of time during which no sound is transmitted. the international version of the morse code is stored in the data file morse. txt.
Answers: 3
image
Computers and Technology, 22.06.2019 04:30, kkeith121p6ujlt
Eye injuries usually occur as a result of all of the following things, except: a) proper machine operation b) battery explosion c) falling or flying debris d) electric welding arc
Answers: 2
image
Computers and Technology, 22.06.2019 23:30, Molly666
What does 21 pilots middle aged name as a band 15 years prior to them naming their band 21 pilots?
Answers: 1
image
Computers and Technology, 23.06.2019 03:00, Julianhooks
State 7 common key's for every keyboard
Answers: 1
Do you know the correct answer?
Write a program that will manipulate Rectangle objects for which you will create a Rectangle class.<...

Questions in other subjects: