Class Animal

java.lang.Object
edu.nwmissouri.animalList.Animal
Direct Known Subclasses:
Aardvark, Abyssinian, Arvicolinae, Asp, Bearcat, BengalTiger, BlackJaguar, BlackPanther, Brachiosaurus, Buffalo, Cat, Cheetah, CongoLion, Cow, Crocodile, Dalmatian, Deer, Dinosaur, Duck, Elephant, ElephantBird, Emu, FerociousTiger, Floppy, Frog, Gerenuk, Giraffe, Glyptodon, Goat, Griffin, HarpSeal, Hippopotamus, Kangaroo, Kangaroov, Koala, Liger, Lion, Lioness, MightyLion, MuleDeer, Okapi, Panda, Panthera, PolarBear, ProngHorn, Puma, Rabbit, RelayHorse, RoaringLion, Shoebill, SiberianTiger, Squirrel, Stag, StringRay, SunBear, TauntingTiger, Unicorn, Walrus, Xraytetra, YukonMoose

public abstract class Animal extends Object
Animal super class for traits shared by all animals. Abstract - don't make a general animal - only specific types.
Author:
Dr. Case
  • Field Details

    • name

      protected String name
      Every animal has a name. Class variable name is not private, but protected - only subclasses can use it.
    • gender

      protected AnimalGender gender
      Animals have an associated gender which may be unknown. We limit the choices for selection by using an enum
  • Constructor Details

    • Animal

      public Animal(String name)
      Animal constructor
      Parameters:
      name - - the name of this instance of an animal
  • Method Details

    • speak

      public abstract void speak()
      abstract speak() - has no implementation
    • move

      public abstract void move()
      abstract move() - has no implementation
    • getName

      public String getName()
      Get animal's name.
      Returns:
      name
    • getGender

      public AnimalGender getGender()
      Get the animal gender.
      Returns:
      the gender
      See Also:
    • setGender

      public void setGender(AnimalGender gender)
      Set the animal gender using an enum
      Parameters:
      gender - the gender to set
      See Also: