The "taxicab distance" between two points in space is defined to be the distance
that would need to be travelled to get from one to the other using segments
that are parallel to the axes. This is generally longer than the (straight-line)
distance between the two points.
We know the taxicab distance between two points. We want to know the maximum
straight-line distance between them if they lie in the
rectangular region { (x,y) | 0<=x<=maxX, 0<=y<=maxY }.
Create a class Taxi that contains a method maxDis that is given maxX, maxY,
and taxiDis and that returns the largest possible straight-line distance between
the two points. If no two points within the given region have the given taxicab
distance, return -1.0.
|