Add the following accessor method to the Point class: public int manhattanDistance(Point other) Returns the Manhattan distance

Question:

Add the following accessor method to the Point class:

public int manhattanDistance(Point other)

Returns the “Manhattan distance” between the current Point object and the given other Point object. The Manhattan distance refers to the distance between two places if one can travel between them only by moving horizontally or vertically, as though driving on the streets of Manhattan. In our case, the Manhattan distance is the sum of the absolute values of the differences in their coordinates; in other words, the difference in x plus the difference in y between the points.

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

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: