first commit

This commit is contained in:
Jose Caban
2025-06-07 01:59:34 -04:00
commit 388ac241f0
3558 changed files with 9116289 additions and 0 deletions

View File

@@ -0,0 +1,106 @@
/**
* <PRE>
* GoldFish.java
*
* Revisions: 1.0 Sep. 19, 2002
* Created the GoldFish class
* 1.1 Sep. 20, 2002
* Finished, Compiled, Commented
*
* </PRE>
*
* 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 <A HREF="mailto:gtg184g@mail.gatech.edu">Jose Manuel Caban</A>
* @version Version 1.1, Sep. 20, 2002
*/
public class GoldFish extends Fish{
////////////////
//Constructors//
////////////////
/**
*Constructor for GoldFish
*@param name to be given to goldfish
*@param value to be given to depth
*/
public GoldFish(String name, int depth){
super(name,depth);
}
///////////
//Methods//
///////////
/**
*isDangerous method for fish
*@return false
*/
public boolean isDangerous(){
return false; //you TA's obviously don't know the goldfish like i do...
}
/**
*Have the Goldfish eat some food
*@param if the food is "fish food", set isHungry to false
*/
public void eat(String food){
if(food.equals("fish food")){
setIsHungry(false);
}
}
/**
* Change standard string to output to be used for this specific program
* @return phrase as string
*/
public String toString(){
return ("A GoldFish named " + getName() + " at depth " + getDepth() +
" that is " + (getIsHungry()?"":"not ") + "hungry.");
}
/**
*Equals method for GoldFish
*@param obj the value to be compared to
*@return false if not a GoldFish
*/
public boolean equals(Object obj){
if(!(obj instanceof GoldFish)){
return false;
}
if(!(super.equals(obj))){
return false;
}
return true;
}
/**
* Debugging main for class GoldFish.
* This method will rigorously test my code.
*
* <br><br>
* @param args a String array of command line arguments.
*/
public static void main(String[] args) {
GoldFish butch = new GoldFish("Butch", -6); //I've seen em leave their cup
System.out.println(butch);
GoldFish butch2 = new GoldFish("Cassidy",54);
butch2.setIsHungry(true);
System.out.println(butch2);
System.out.println(butch.equals(butch2));
System.out.println(butch.equals(butch));
}// end of main(String[] args)
}// end of class GoldFish