Question: java code 6.39 (Geometry: point position) Programming Exercise 3.32 shows how to test whether a point is on the left side of a directed line,
java code
6.39 (Geometry: point position) Programming Exercise 3.32 shows how to test whether a point is on the left side of a directed line, on the right, or on the same line. Write the methods with the following headers: Return true if point (x2, y2) is on the left side of the * directed line from (x0, y0) to (x1, yl) */ public static boolean leftOfTheLine (double x0, double y0, double xl, double yl, double x2, double y2) Return true if int (x2, y2) is on the same line from (x0, y0) to (x1, yl) */ public static boolean onTheSameLine (double x0, double yo, double xl, double yl, double x2, double y2) Return true if point (x2, y2) is on the line segment from (x0, y0) to (x1, y1) */ public static boolean onTheLineSegment (double x0, double yo, double xl, double yl, double x2, double y2) Write a program that prompts the user to enter the three points for p0, pl, and p2 and displays whether p2 is on the left of the line from p0 to pl, right, the same line, or on the line segment. Here are some sample runs: Enter three points for p0, pl, and p2: 1 1221.5 1.5 (1.5, 1.5) is on the line segment from (1.0, 1.0) to (2.0, 2.0) Enter three points for pO, pl, and p2: 11 22 3 3 Enter (3.0, 3.0) is on the same line from (1.0, 1.0) to (2.0, 2.0) Enter three points for po, pl, and p2: 1 1 2 2 1 1.5 Eter (1.0, 1.5) is on the left side of the line from (1.0, 1.0) to (2.0, 2.0) Enter three points for p0, pl, and p2: 11 221 -1 (1.0, -1.0) is on the right side of the line from (1.0, 1.0) to (2.0, 2.0)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
