/** *
* Shark.java * * Revisions: 1.0 Sep. 19, 2002 * Created the Shark class * 1.1 Sep. 20, 2002 * Finished, Compiled, Commented * ** * Collaboration Statement: * I worked on the homework assignment alone, using only * course materials. * * Created with JCreatorLE, some indents are off when viewed through notepad * or EMACS * * @author Jose Manuel Caban * @version Version 1.1, Sep. 20, 2002 */ public class Shark extends Fish{ //////////////// //Constructors// //////////////// /** *Constructor for Shark *@param name of the Shark *@param depth of the shark */ public Shark(String name, int depth){ super(name,depth); } /////////// //Methods// /////////// /** *Eat method for Shark *@param food to eat, if it's human, chicken,fish isHungry = false */ public void eat(String food) { if(food.equals("human")){ //mmmmmm... setIsHungry(false); } else if(food.equals("chicken")){ //tastes like chicken setIsHungry(false); } else if(food.equals("fish")){ //IT ATE ITS OWN SUPERCLASS!!! setIsHungry(false); } } /** *Give the dangerous value of the Shark *@return true, the Shark is dangerous */ public boolean isDangerous(){ return true; } /** *Find the equality of Shark *@param obj the Object to be compared to *@return the equality value */ public boolean equals(Object obj){ if(!(obj instanceof Shark)){ return false; } if(!(super.equals(obj))){ return false; } return true; } /** *Modify String for this particular program *@return the data of the Shark as a string statement */ public String toString(){ return ("A Shark named " + getName() + " at depth " + getDepth() + " that is " + (getIsHungry()?"":"not ") + "hungry."); } /** * Debugging main for class Shark. * This method will rigorously test my code. * *