Problem

Write a program that outputs the equation of the perpendicular bisector of the line segmen...

Write a program that outputs the equation of the perpendicular bisector of the line segment between two points. Your program should

■ prompt for and input the coordinates of the two points [for example, try the points (2.0, −4.0) and (7.0, −2.0)];

■ compute the slope of the line between those two points;

■ compute the coordinates of the midpoint of the line segment between the two points by averaging the two x coordinates and the two y coordinates;

■ compute the slope of the perpendicular bisector by taking the negative reciprocal of the slope of the line segment;

■ compute the y intercept of the perpendicular bisector (you now have the slope m of the bisector and a point (x mid, y mid) on the bisector, so the y intercept is y midm x mid); and

■ output with labels the original two points, and output in y = mx+ b format the equation of the perpendicular bisector. Figure 2.19 illustrates the sample line segment mentioned above and its perpendicular bisector. Test your program to be sure it works on different pairs of points. However, there will be some pairs of points for which you can’t make your program work (at least not at this stage). Think about what points will cause your program to fail, and write a paragraph describing which points fall in this category.

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 2