Create the Animal class, which is the abstract superclass of all animals
-Declare a protected integer attribute called legs, which records the number of legs for this animal.
-Define a protected constructor that initializes the legs attribute.
-Declare an abstract method eat.
-Declare a concrete method walk that prints out something about how the animals walks (including the number of legs).
2.Create the Spiderclass.
-The Spider class extends the Animal class.
-Define a default constructor that calls the superclass constructor to specify that all spiders have eight legs.
-Implementthe eatmethod.
-Create the Petinterface specified by the UML diagram.
-Create the Cat class that extends Animaland implements Pet.
-This class must include a Stringattribute to store the name of the pet.
Comments
Leave a comment