X674: Slope

Given two Points p1 and p2, return the slope of the line defined by the two points. If the line is vertical the slope is not defined and your routine should return Double.NaN.

Beware, integer division truncates the result.

Examples:

slope(new Point(10,10),new Point(100,100)) -> 1.0

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.