(Geometry: point position) Programming Exercise shows how to test whether
a point is on the left side of a directed line, right, or on the same line. Write the following functions:
/** Return true if point (x2, y2) is on the left side of* directed line from (x0, y0) to (x1, y1) */ bool leftOfTheLine(double x0, double y0,double x1, double y1, double x2, double y2)/** Return true if point (x2, y2) is on the same* line from (x0, y0) to (x1, y1) */ bool onTheSameLine(double x0, double y0,double x1, double y1, double x2, double y2)/** Return true if point (x2, y2) is on the* line segment from (x0, y0) to (x1, y1) */ bool onTheLineSegment(double x0, double y0,double x1, double y1, double x2, double y2)
Write a program that prompts the user to enter the three point s for p0, p1, and p2 and displays whether p2 is on the left of the line from p0 to p1, right, the same line, or on the line segment. Here are some sample runs:




Programming Exercise
(Geometry: Point position) Given a directed line from Point p 0(x0 , y0) to p 1(x1 , y1), you can use the following condition to decide whether a Point p2(x2 , y2) is on the left of the line, on the right, or on the same line (see Figure):




Figure (a) p 2 is on the left of the line. (b) p 2 is on the right of the line. (c) p2 is on the same line.
Write a program that prompts the user to enter the three Points for p 0, p 1, and p 2 and displays whether p 2 is on the left of the line from p0 to p1, to the right, or on the same line. Here are some sample runs:


![]()
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.