### Problem Statement

```Class name: WhaleWatcher
Method name: getWhaleSightings
Parameters: String[], int,  int , int , String
Returns: int

Implement a class WhaleWatcher, which has a method getWhaleSightings.

TopCoder will enforce the following rules:
*WhalePositions has between 1 and 10 Strings, inclusive.
*Passengers is between 1 and 100, inclusive.
*StartPosition is between 0 and 9, inclusive
*TripDistance is between 0 and 9, inclusive.
*Weather is one of "Cloudy", "Foggy", "Sunny"
*The elements of WhalePositions are of the form "X,Y", where X and Y represent
integers between 0 and 9, inclusive.
*The elements of WhalePositions will be distinct (not repeated)

(In this problem statement, the variable names will sometimes be enclosed in
angle brackets <> for clarity)

The following are true:
*All action takes place on a 10x10 grid whose cells are referenced by Strings
of the form "X,Y" where X and Y are between 0 and 9.
*The point "0,0" through "9,0" are the cells in the water next to the shoreline.
*The good ship Orca takes on up to 100 passengers and leaves port at a point
represented by "StartPosition,0".
*It then travels straight out to sea until it reaches the position
"StartPosition,TripDistance".  That is, the ship starts at the point
"StartPosition,0", moves to "StartPosition,1", etc. until it reaches the point
"StartPosition,TripDistance".
Another way to say this is "The boat starts at <StartPosition> and moves up
<TripDistance> number of grid spaces".  If you think of the boat moving through
time, then at time 1, the boat would be at "StartPositionX,0".  At time 2, the
boat would be at "StartPosition,1", and at time <TripDistance>, the boat would
be at "StartPosition,TripDistance".

Your method should return the total number of times a passenger sees a whale on
this trip.

*The passenger's position on the boat does not matter.
The passengers will see whales in the following way:
*The passengers never see whales that are directly under the boat.
*If the weather is "Foggy", passengers will only see whales that are in the
cells immediately adjacent to the boat. (If boat is at "2,3", passengers will
see whales that are in the cells "1,4", "2,4", "3,4", "1,3", "3,3", "1,2",
"2,2" and "3,2")
*If the weather is "Cloudy", passengers will see whales up to 2 cells away from
the boat.
*If the weather is "Sunny", passengers will see whales up to 3 cells away from
the boat.

*The boat will move on the aforementioned path one graph unit at a time.
Each time the boat moves, check to see which whales can be seen.
*If a whale is seen by the passengers once, never count that whale again.

The method signature is (be sure your method is public):
public int getWhaleSightings(String[] WhalePositions, int Passengers, int
StartPosition, int TripDistance, String Weather)

Example 1:

WhalePositions = { "2,3", "5,6" }
passengers = 50
StartPosition = 5
TripDistance = 4
Weather = "Sunny"

The boat starts at "5,0" and will move through the cells "5,1", "5,2", "5,3",
and "5,4".

Grid:

0 1 2 3 4 5 6 7 8 9
+-+-+-+-+-+-+-+-+-+-+
9| | | | | | | | | | |
+-+-+-+-+-+-+-+-+-+-+
8| | | | | | | | | | |
+-+-+-+-+-+-+-+-+-+-+
7| | | | | | | | | | |
+-+-+-+-+-+-+-+-+-+-+
6| | | | | |W| | | | |
+-+-+-+-+-+-+-+-+-+-+
5| | | | | | | | | | |
+-+-+-+-+-+-+-+-+-+-+
4| | | | | |5| | | | |
+-+-+-+-+-+-+-+-+-+-+
3| | |W| | |4| | | | |
+-+-+-+-+-+-+-+-+-+-+
2| | | | | |3| | | | |
+-+-+-+-+-+-+-+-+-+-+
1| | | | | |2| | | | |
+-+-+-+-+-+-+-+-+-+-+
0| | | | | |1| | | | |
+-+-+-+-+-+-+-+-+-+-+
0 1 2 3 4 5 6 7 8 9

Legend:
W = whale
A number N = the position the boat is in at time N

When the boat is at:            Passengers See Whales at:
---------------------------------------------------------
"5,0"                           "2,3"
"5,1"                           "2,3" (2nd sighting)
"5,2"                           "2,3" (3rd sighting)
"5,3"                           "2,3" (4th sighting), "5,6"
"5,4"                           "2,3" (5th sighting), "5,6" (2nd sighting)

The passengers saw a total of 2 whales so return 50 * 2 = 100.

Example 1:

WhalePositions = { "2,3", "5,6", "9,0", "9,1", "8,2"}
passengers = 12
StartPosition = 9
TripDistance = 1
Weather = "Foggy"

The boat starts at "9,0" and will move to the cell "9,1".

Grid:

0 1 2 3 4 5 6 7 8 9
+-+-+-+-+-+-+-+-+-+--+
9| | | | | | | | | |  |
+-+-+-+-+-+-+-+-+-+--+
8| | | | | | | | | |  |
+-+-+-+-+-+-+-+-+-+--+
7| | | | | | | | | |  |
+-+-+-+-+-+-+-+-+-+--+
6| | | | | |W| | | |  |
+-+-+-+-+-+-+-+-+-+--+
5| | | | | | | | | |  |
+-+-+-+-+-+-+-+-+-+--+
4| | | | | | | | | |  |
+-+-+-+-+-+-+-+-+-+--+
3| | |W| | | | | | |  |
+-+-+-+-+-+-+-+-+-+--+
2| | | | | | | | |W|  |
+-+-+-+-+-+-+-+-+-+--+
1| | | | | | | | | |2W|
+-+-+-+-+-+-+-+-+-+--+
0| | | | | | | | | |1W|
+-+-+-+-+-+-+-+-+-+--+
0 1 2 3 4 5 6 7 8 9

Legend:
W = whale
A number N = the position the boat is in at time N

(The ninth column is widened to accomodate the two chars that show
that the boat and a whale are in the same cell at that time)

When the boat is at:            Passengers See Whales at:
---------------------------------------------------------
"9,0"                           "9,1"
"9,1"                           "9,0", "8,2"

The passengers saw a total of 3 whales so return 12 * 3 = 36.

Test cases:

WhalePositions = "0,9"
passengers = 14
StartPosition = 0
TripDistance = 9
Weather = "Foggy"
returns 14

WhalePositions = "8,1" "8,2" "9,9"
passengers = 10
StartPosition = 9
TripDistance = 4
Weather = "Cloudy"
returns 20

WhalePositions = "5,5" "4,3" "6,1" "5,9"
passengers = 5
StartPosition = 5
TripDistance = 5
Weather = "Sunny"
returns 15

```

### Definition

 Class: WhaleWatcher Method: getWhaleSightings Parameters: String[], int, int, int, String Returns: int Method signature: int getWhaleSightings(String[] param0, int param1, int param2, int param3, String param4) (be sure your method is public)

#### Problem url:

http://www.topcoder.com/stat?c=problem_statement&pm=175

#### Problem stats url:

http://www.topcoder.com/tc?module=ProblemDetail&rd=4003&pm=175

jay_peg