Question: In java programming language. Exercise 2: A line can be defined by two points, p1: (x1, y) and P2: (x2, Y2). The slope of the
In java programming language.

Exercise 2: A line can be defined by two points, p1: (x1, y) and P2: (x2, Y2). The slope of the line can be determined by 2-3 , given that x2 X1 + 0. If y2 y = 0, then it is a horizontal -X1 line, and if x2 x1 , then it is a vertical line. The slope of a vertical line is undefined. Two lines are parallel if they have the same slope or both are vertical lines. Two lines are perpendicular if one of the lines is horizontal and another is vertical, or if the product of their slopes is -1. Design the class lineType to store a line. To store a line, you need to store two Point objects. Your class must contain the following operations: a) If a line is nonvertical, then determine its slope. b) Determine if two lines are equal. c) Determine if two lines are parallel. d) Determine if two lines are perpendicular. Add appropriate constructors to initialize variables of lineType. Also write a program to test your class
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
