iterate through list of fish for each fish that


Iterate through list of Fish. For each fish that isAlive, do the following:
*


* 1. If this fishIsSurroundedByRocks, DO NOTHING, and move on to the next fish.
* (This fish will not turn.)
*


* 2. If this fish''s direction is not equal to one of the codes UP, DOWN, LEFT, or
* RIGHT, then throw an IllegalFishDirectionException, passing this fish''s
* direction to the constructor.
*


* 3. Check whether or not this fish is about to hit a rock if it moves in it''s
* current direction. If it is about to hit a rock, call the fish''s
* setRandomDirection method. Repeat this step until the fish is no longer
* about to hit a rock. Do not make any EXTRA calls to setRandomDirection or
* you will fail our tests!
*/

public void turnFish() {

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: iterate through list of fish for each fish that
Reference No:- TGS0276503

Expected delivery within 24 Hours