Loading
notes intro/old submit AP Problems the dump links
 

Inheritance Warmup

 

Create an animal class tracking age,weight, name, species. Have a toString, eat method, talk (that returns "hi").

Create a class dog and cat that extend animal with relevant info.

 

Update animal so you track age as well. Have a method in cat and dog - toHumanYears (which will print out how many years that animal is in human years [dog is 7yrs, cats is 4 yrs]. Add age to constructors.

 

Create a new subclass of Dog called PoundDog that will extend dog. Its constructor will initialize a dog but only have weight and visableAge (as a String (they will put in - puppie, young, middle age, old) . The name will automatically be set to "Unknown", the age is -1.

Override the bark command so that it calls the bark of the dog class then, "please take me home, I dont want to be put down :<"

Create a new method beg that will beg.

Override toString so that it returns - "This 12lb pound dog is a puppie, and is of unknown age."

Override the eat so it will do the dogs eat then beg, then have it do dogs eat with 1/2 as much food.