Java for Programmers:
Lab 8
Create an Animal class that will be the superclass of Person.
Provide instance variables in Animal to represent that Animal's
genus and species.
(These should be Strings)
Provide getter and setter methods to access and set the genus
and species.
Create a constructor for Animal that takes two String arguments:
a genus and a species.
This will force all subclasses to specifically provide a
genus and species.
Alter the Person class so that it extends Animal.
Alter Person's constructor to call the superclass constructor,
providing the String arguments
required by the Animal constructor. ("homo", "sapiens")
In runner, when you print out Person's attributes, also
print out their genus and species.
|