////////////////////////// Dog Class Example ////////////////////////////////
import java.io.*;
class Dog extends Animal {
/** 3 variables to hold information about our "pooch" */
private boolean longHaired;
private String showClass;
private String name;
/** Empty "default" constructor" */
Dog() {
super();
}
/** Constructor initializes our variables with the incoming parameters values of the same name */
Dog(int height, int weight, int lifespan, boolean longHaired, String showClass, String name) {
super(height, weight, lifespan);
this.longHaired = longHaired;
this.showClass = showClass;
this.name = name;
}
/** Set methods for all of our varaibles to change our information */
public void setLongHaired(boolean longHaired) {
this.longHaired = longHaired;
}
public void setShowClass(String showClass) {
this.showClass = showClass;
}
public void setName(String name) {
this.name = name;
}
/** Get methods for all of our varaibles to retrieve our information */
public boolean getLongHaired() {
return longHaired;
}
public String getShowClass() {
return showClass;
}
public String getName() {
return name;
}
/** method allows our dog to "sleep" (Overrides sleep method in the superclass, Animal) */
public void sleep(int howLong) {
howLong *= 2;
for (int x = 0; x < howLong; x++) {
System.out.println("I'm Sleeping now");
}
}
};