Question: Exercise III - Line Class Write another class Line that represents the line between two Points. It should include the following methods: Line(Point p1, Point

 Exercise III - Line Class Write another class Line that represents

Exercise III - Line Class Write another class Line that represents the line between two Points. It should include the following methods: Line(Point p1, Point p2) // constructor Line(int x1, int x2, int x2, int y2) // constructor getP1() // returns the first Point getP2() // returns the second Point getslope() // returns the slope of the Line. (Use the formula, slope (y2-y1)/(x2-x1)) isCollinear (Point p) // returns whether the point p is collinear to the current Line (this). toString() // returns a string representation of the Line as "[(x1, y1), (x2,y2)]" Write a main method in the same class or in another class) to test all the methods of the Line class. Exercise III - Line Class Write another class Line that represents the line between two Points. It should include the following methods: Line(Point p1, Point p2) // constructor Line(int x1, int x2, int x2, int y2) // constructor getP1() // returns the first Point getP2() // returns the second Point getslope() // returns the slope of the Line. (Use the formula, slope (y2-y1)/(x2-x1)) isCollinear (Point p) // returns whether the point p is collinear to the current Line (this). toString() // returns a string representation of the Line as "[(x1, y1), (x2,y2)]" Write a main method in the same class or in another class) to test all the methods of the Line class

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!