Reference no: EM132211521
Question :
Write a program that has the user input two points in the xy-plane, and then displays the equation of the line through those points in y = mx + b form. This should involve some very minor algebra, so it should be easy, but there's one catch:
I want you to design your program so that the user will enter each point in the following format: (2, 3). That is, an opening (, a number, a comma, a number, a closing ).
So, your interface should look like:
Enter the first point: (1.1,2)
Enter the second point: (2.6,8)
The equation is: y = 4x - 2.4
(Here, the (1.1,2) and (2.6,8) are values chosen and input by the user; they should NOT be part of your code. The rest of the above is output shown.)
Specifications: your program must
• clearly ask the user to enter two points, and then accept any two points in the xy-plane (so long as they have different x-coordinates) from the user, who will enter the points in the form shown - e.g., (3,4).
• clearly display the equation of the line through those two points in y = mx + b form as shown above. "Ugly" output, e.g. y = 0x + -5 instead of y = -5 is acceptable.