////////////////////////// Animal Class Example E ////////////////////////////////
class Animal {
/** 3 numeric variables to hold our information */
private int height;
private int weight;
private int lifespan;
/** Empty "default" constructor" */
Animal() {
}
/** Constructor initializes our 3 variables with the three incoming parameter values of the same name */
Animal(int height, int weight, int lifespan) {
this.height = height;
this.weight = weight;
this.lifespan = lifespan;
}
/** method allows our animal to "eat" (Just prints out "Im eating now") */
public void eat() {
System.out.println("I'm eating now");
}
/** method accepts a numeric value (howLong) to control a loop that will print out "Im sleeping now" as many times as the number entered */
public void sleep(int howLong) {
for (int x = 0; x < howLong; x++) {
System.out.println("I'm Sleeping now");
}
}
};