Add the following accessor method to your Line class: public double getSlope() Returns the slope of this

Question:

Add the following accessor method to your Line class:

public double getSlope()

Returns the slope of this Line . The slope of a line between points (x1, y1) and (x2, y2) is equal to (y2 − y1) / (x2 − x1). If x2 equals x1 the denominator is zero and the slope is undefined, so you may throw an exception in this case.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question

Building Java Programs A Back To Basics Approach

ISBN: 9780135471944

5th Edition

Authors: Stuart Reges, Marty Stepp

Question Posted: