public Animal createAnimal(int animalCode) { Animal newAnimal = null; switch (animalCode) { case 0: newAnimal = new Eagle(); break; case 1: newAnimal = new Dear(); break; case 2: newAnimal = new Bear(); break; case 3: newAnimal = new Wolf(); break; } return(newAnimal); }
public Animal createAnimal(int animalCode) { Animal newAnimal = null; switch(animalCode) { case 0: newAnimal = new Eagle(); break; case 1: newAnimal = new Dear(); break; case 2: newAnimal = new Bear(); break; case 3: newAnimal = new Wolf(); break; } return newAnimal; }