Manhattan distance is the distance between two points in a grid (like the grid-like street geography of the New York borough of Manhattan) calculated by only taking a vertical and/or horizontal path.
Write a function int manhattanDistance(Point, Point)
that returns the Manhattan Distance between the two points.
- The class
Point
is immutable (its state cannot be changed after instantiation) - The class
Point
has no getters - The class
Point
has no public properties (i.e. the internal state cannot be read from outside the class).