public Animal createAnimal(int animalCode) { Animal newAnimal = null; switch (animalCode) { case 0: newAnimal = new Kangaroo(); break; case 1: newAnimal = new FrilledNeckLizard(); break; case 2: newAnimal = new Wombat(); break; case 3: newAnimal = new Crocodile(); break; } return(newAnimal); }
public Animal createAnimal(int animalCode) { Animal newAnimal = null; switch (animalCode) { case 0: newAnimal = new Kangaroo(); break; case 1: newAnimal = new FrilledNeckLizard(); break; case 2: newAnimal = new Wombat(); break; case 3: newAnimal = new Crocodile(); break; } return newAnimal; }