The requested project is dealing with some analysis of 2D straight line geometric shapes. As you studied in your earlier stages, a straight line has many defining equation forms in 2D geometry. One famous equation for defining straight line is: while a, b and c are real numbers. Any 2 straight lines in the plane are either parallel (have no intersection point) or intersected in a point in the plane. If the two straight lines are defined as: The two straight lines are considered parallel if: a1b2 = a2b1. The two straight lines are considered not parallel and intersected in an intersection point (xi, yi) where a1b2 ≠ a2b1 and in this case the coordinates of the intersection point and are defined as: Implement a Java program that reads from the user the 6 coefficient values of the 2 straight lines a1,b1,c1 and a2,b2,c2 (for minimum 20 pairs of straight lines.) The program checks, for each pair, if they are parallel or intersected. If, for each pair, they are intersected, the program has to computer the coordinates of the intersection point as given in equation 3. Finally, the program should print the number and percent ratio (rounded to 2 decimal places) of: o Parallel straight line pairs. o Intersected straight line pairs. o Intersected straight line pairs with intersection point on x-axis or y-axis. o Intersected straight line pairs with intersection point in first plane quadrant. o Intersected straight line pairs with intersection point in second plane quadrant. o Intersected straight line pairs with intersection point in third plane quadrant. o Intersected straight line pairs with intersection point in fourth plane quadrant. Note: You may use digital library or internet to check each case of intersection point coordinates. The program should works EXACTLY as given sample run Sample Run:
Enter number of straight line pairs: 12 Minimum accepted number of straight line pairs is 20 Enter number of straight line pairs: 27 Enter pair 1 straight line 1 coefficient: 1 3 4 Enter pair 1 straight line 2 coefficient: 2 1 3 Intersected straight lines in point (-1.00,-1.00) that lies in third quadrant Enter pair 2 straight line 1 coefficient: 2 5 1 Enter pair 2 straight line 2 coefficient: 3 1 3 Intersected straight lines in point (-1.08,0.23) that lies in second quadrant Enter pair 3 straight line 1 coefficient: 2 2 2 Enter pair 3 straight line 2 coefficient: 3 1 4 Intersected straight lines in point (-1.50,0.50) that lies in second quadrant. Enter pair 26 straight line 1 coefficient: 4 3 2 Enter pair 26 straight line 2 coefficient: 1 2 3 Intersected straight lines in point (1.00,-2.00) that lies in fourth quadrant Enter pair 27 straight line 1 coefficient: 1 1 1 Enter pair 27 straight line 2 coefficient: 2 2 2 Parallel straight lines Program Statistics >>>>>>>>>>>>>>>>>>>>>>> Number of entered pairs of straight lines: 27 Number of parallel pairs of straight lines: 5 with 19% of the given pairs Number of intersected pairs of straight lines: 22 with 81% of the given pairs Number of pairs of straight lines with intersection point on x-axis or y-axis: 4 with 18% of the intersected pairs Number of pairs of straight lines with intersection point in the first quadrant: 8 with 36% of the intersected pairs Number of pairs of straight lines with intersection point in the second quadrant: 5 with 23% of the intersected pairs Number of pairs of straight lines with intersection point in the third quadrant: 2 with 9% of the intersected pairs Number of pairs of straight lines with intersection point in the fourth quadrant: 3 with 14% of the intersected pairs
Aucun commentaire:
Enregistrer un commentaire