Imani G.

asked • 10/04/23

java method creation

public Point2D[] getEndpoints()

This method creates and returns an array containing copies of the two endpoints of this Line2D object. Note that the length of this array must be 2 and the order of the Point2D objects in the array is insignificant.


public double distance()

  1. This method returns the distance between the two endpoints of this Line2D object. This method must call the distance method in Point2D for the instance variables of this object, taking advantage of the Euclidean formula for distance implemented there.

public double slope()

  1. This method returns the slope of this Line2D object. This method must call the slope method in Point2D for the instance variables of this object, taking advantage of the slope formula implemented there.

public Point2D midpoint()

  1. This method returns the Point2D object that is the midpoint of this Line2D object. This method must call the midpoint method in Point2D for the instance variables of this object, taking advantage of the operation implemented there.


1 Expert Answer

By:

Makendy M. answered • 10/04/23

Tutor
New to Wyzant

Master's Student in Computer Science

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.