Class Seahorse

java.lang.Object
  |
  +--Animal
        |
        +--MovingAnimal
              |
              +--Seahorse

public class Seahorse
extends MovingAnimal
implements ReproducesbyEggs

This class provides ability to print H for Seahorse objects, defines makeMove() and laysEggs() for Seahorses


Method Summary
 char getPrintChar()
          provides print character for Seahorse object
 Set laysEggs()
          method for reproducing by laying eggs; always lays 1 egg per reproduction period
 Location makeMove(Location myLoc, World myWorld)
          function provides a new Location to which the Seahorse object can move; checks that it moves with the current note: chose to try 8 randomly chosen directions
 
Methods inherited from class MovingAnimal
getDirection, getSpeed, setSpeed
 
Methods inherited from class Animal
getAge, getmaxAge, incrAge, setmaxAge, timeToDie
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getPrintChar

public char getPrintChar()
provides print character for Seahorse object
Overrides:
getPrintChar in class Animal
Returns:
char 'H' for Seahorse

makeMove

public Location makeMove(Location myLoc,
                         World myWorld)
function provides a new Location to which the Seahorse object can move; checks that it moves with the current note: chose to try 8 randomly chosen directions
Overrides:
makeMove in class Animal
Returns:
Location to which Seahorse can move

laysEggs

public Set laysEggs()
method for reproducing by laying eggs; always lays 1 egg per reproduction period
Specified by:
laysEggs in interface ReproducesbyEggs
Returns:
Set with one new Seahorse object