Question: Question about Java Write a class called Line that represents a line segment between two Points. Your Line objects should have the following methods: public

 Question about Java Write a class called Line that represents a Question about Java

Write a class called Line that represents a line segment between two Points. Your Line objects should have the following methods:

public Line(Point p1, Point p2)

Constructs a new line that contains the given two points.

public Point getP1()

Returns this line's first endpoint.

public Point getP2()

Returns this line's second endpoint.

 
public String toString()

Returns a string representation of this line, such as "[(22, 3), (4, 7)]".

BJP5 Exercise 8.14: classLine Language/Type: Author: Marty Stepp (on 2019/09/19) Write a class called Line that represents a line segment between two Points. Your Line objects should have the following methods: public Line(Point p1, Point p2) Constructs a new line that contains the given two points. public Point getP1 () Returns this line's first endpoint. public Point getP2( ) Returns this line's second endpoint. 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

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!