Hello. I am having a hard time understanding this concepts and it seems I am stuck. I really need help, and sorry if I am asking for too much of your time.

I completed the chapter for classes and started with the exercises.

The first one is :

Add the following 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.

Okay, splendid. I think I did something but I don't understand what. I don't understand what is this "other" thing, where does it come from and what is it's purpose. Also, there is no client code so I can actually run this. It's just his and I have no idea what is going on here.

there are four more exercises like this which I also did so they compile.

2. Add the following method to the Point class:

public boolean isVertical(Point other)

Returns true if the given Point lines up vertically with this Point, that is, if their x-coordinates are the same.

3. Add the following method to the Point class:

public double slope(Point other)

Returns the slope of the line drawn between this Point and the given other Point. Use the formula (y2 – y1) / (x2 – x1)

to determine the slope between two points (x1, y1) and (x2, y2). Note that this formula fails for points with identical

x-coordinates, so throw an IllegalArgumentException in this case.

4. Add the following method to the Point class:

public boolean isCollinear(Point p1, Point p2)

Returns whether this Point is collinear with the given two other Points. Points are collinear if a straight line can be

drawn that connects them. Two basic examples are three points that have the same x- or y-coordinate. The more general

case can be determined by calculating the slope of the line between each pair of points and checking whether this

slope is the same for all pairs of points. Use the formula (y2 – y1) / (x2 – x1) to determine the slope between two points

(x1, y1) and (x2, y2). (Note that this formula fails for points with identical x-coordinates so this will have to be a special

case in your code.) Since Java’s double type is imprecise, round all slope values to a reasonable accuracy such as

four digits past the decimal point before you compare them.

And what I did.