public void AddPet(String petName, Constants.PET_TYPE petType, Constants.SPECIES_TYPE speciesType) { if (petType == Constants.PET_TYPE.INORGANIC) { this.containedPets.Add(new PetRobot(petName, speciesType)); } else { this.containedPets.Add(new PetOrganic(petName, speciesType)); } Console.WriteLine("Pet was successfully added: " + petName); }
private static void AddNewPet() { Console.WriteLine("Please enter the pets name"); String petName = Console.ReadLine(); Console.WriteLine("Please enter the pet type: [0] cat, [1] dog"); int species = int.Parse(Console.ReadLine()); Constants.SPECIES_TYPE speciesType = (Constants.SPECIES_TYPE)species; Console.WriteLine("Do you want a living or robotic pet? Enter : [0] organic, [1] inorganic"); int organicInorganicChoice = int.Parse(Console.ReadLine()); Constants.PET_TYPE petType = (Constants.PET_TYPE)organicInorganicChoice; PetShelters.DefaultShelter.AddPet(petName, petType, speciesType); Console.WriteLine("You created a new pet: " + petName); }