Question: Four doubles are read from input, where the first two doubles are the x and y values of point 1 and the second two doubles

Four doubles are read from input, where the first two doubles are the x and y values of point1 and the second two doubles are the x and y values of point2. Define two functions to overload the + operator. The first function overloads the + operator to add two 2D points. The second function overloads the + operator to add a 2D point and a double representing the x value of the point.
Ex: If the input is 15.512.53.55.5, then the output is:
(15.5,12.5)+(3.5,5.5)=(19,18)
(15.5,12.5)+3.5=(19,12.5)
Note: The sum of two points is:
the sum of the x values of the points
the sum of the y values of the points
Note: The sum of a point and a double representing the x value of the point is:
the sum of the x value of the point and the double
the y value of the point is unchanged

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!