Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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