Problem

(Program) Write a C++ program to calculate and display the midpoint coordinates of the l...

(Program) Write a C++ program to calculate and display the midpoint coordinates of the line connecting the two points with coordinates of (3,7) and (8,12). Use the fact that the midpoint coordinates between two points with the coordinates (x1,y1) and (x2,y2) are ((x2 + x1) / 2, (y2 + y1) / 2). Your program should produce this display:

The x coordinate of the midpoint is xxx.xx

The y coordinate of the midpoint is xxx.xx

The xxx.xx denotes placing the calculated value in a field wide enough for three places to the left of the decimal point and two places to the right of it.

Verify your program using the following test data:

Test data set 1: Point 1 = (0,0) and Point 2 = (16,0)

Test data set 2: Point 1 = (0,0) and Point 2 = (0,16)

Test data set 3: Point 1 = (0,0) and Point 2 = (-16,0)

Test data set 4: Point 1 = (0,0) and Point 2 = (0,-16)

Test data set 5: Point 1 = (-5,-5) and Point 2 = (5,5)

When you have completed your verification, use your program to complete the following table.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 3.2