Package edu.nwmissouri.animalList
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
Animal super class for traits shared by all animals. Abstract - don't make a
general animal - only specific types.
- Author:
- Dr. Case
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AnimalGenderAnimals have an associated gender which may be unknown.protected StringEvery animal has a name. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the animal gender.getName()Get animal's name.abstract voidmove()abstract move() - has no implementationvoidsetGender(AnimalGender gender) Set the animal gender using an enumabstract voidspeak()abstract speak() - has no implementation
-
Field Details
-
name
Every animal has a name. Class variable name is not private, but protected - only subclasses can use it. -
gender
Animals have an associated gender which may be unknown. We limit the choices for selection by using an enum
-
-
Constructor Details
-
Animal
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
Get animal's name.- Returns:
- name
-
getGender
Get the animal gender.- Returns:
- the gender
- See Also:
-
setGender
Set the animal gender using an enum- Parameters:
gender- the gender to set- See Also:
-