notes intro/old submit AP Problems the dump links





Create a new project called AnimalSpecies

Create an Animal class tracking age,weight (double), name, species.

  • Have a constructor which will setup all those global variables.
  • Have a toString,
  • eat method (taking in double food //which will be how much food in pounds),
  • talk (that returns "Hi, I'm Paul ").
  • Have getters (getAge, getWeight).
  • Have a static variable - totalFood which will track the total amount of food given to all animals
  • Have a static getter for that variable.

Create another class called Shelter that in the main it will

  • initialize 2 different animals
  • Have each one eat
  • Have them talk
  • Call toString and print out results
  • Print out total food given to all animals



  1. Create a classes Dog that extend Animal. Keep track of Breed.
    1. Create constructor
    2. Create a  getter for breed
    3. Update talk with relevant info.
    4. Update toString so it also returns the breed
  2. Together - lets add to Animal - eat
  3. Create a new subclass of Dog called PoundDog that will extend Dog.
    1. 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, and breed will be mutt
    2. Override the talk command so that it calls the talk of the dog class then, "please take me home, I dont want to be put down :<"
    3. Override the toString method so it also says the visible age (ie, " and the dog looks young")
    4. Create a new method beg that will print "give me more"
    5. Override the eat so it will do the dogs eat then beg, then have it do dogs eat with 1/2 as much food.
  4. Create some instances:
    1. an instance of Dog and call each method on your dog
    2. an instance of PoundDog and call each method on your pound dog
    3. find out how much food in total has been fed to all animals