Question: Write a class called Line that represents a line segment between two points. Your line object should have the following method: NOTE;(EVERY) line of code
Write a class called Line that represents a line segment between two points. Your line object should have the following method:
NOTE;(EVERY) line of code written has to have comments to it
Public Line(Point p1, Point p2)
Constructs a new line that contains the given two Points.
Public Point getP1()
Returns this Lines first endpoint
Public Point getP2()
Returns this line second ndpoint
Public String toString()
Returns a String representation of this Line, such as [(22, 3), (4, 7)]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
