The Animal
is an abstract class with the following methods:
int beEaten()
: returns the number of calories providedvoid gainCalories (int amount)
: increases number of calories.When you construct an Animal
, the
constructor needs to know how many calories are in the animal.
CarnivoreAnimal
is a concrete subclass of Animal
. It also has a
method void eat(Animal other)
. This method causes the
CarnivoreAnimal
to gain the calories provided by the other Animal
(found using the beEaten()
method).