Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started