static void Main(string[] args) { Console.WriteLine("Hello! Welcome to Virtual Pets"); Pet pet = new Pet(); OrganicPet organicPet = new OrganicPet(); RoboticPet roboticPet = new RoboticPet(); Shelter shelter = new Shelter(); Console.WriteLine("\nAdmit your first pet into the Shelter"); bool stillThinking = false; while (stillThinking == false) { Console.WriteLine("Would you like to admit an (1)Organic Pet or a (2)Robotic Pet?"); string petType = Console.ReadLine(); if (petType == "1") { pet = new OrganicPet(); pet.CreatePet(); shelter.AddPetToShelter(pet); stillThinking = true; } else if (petType == "2") { pet = new RoboticPet(); pet.CreatePet(); shelter.AddPetToShelter(pet); stillThinking = true; } else { Console.WriteLine("Select (1) or (2)"); } } bool keepThinking = true; while (keepThinking) { Console.WriteLine("1. Feed your pet"); Console.WriteLine("2. Take your pet to the vet"); Console.WriteLine("3. Play with your pet"); Console.WriteLine("4. Admit a New Pet Into Shelter"); Console.WriteLine("5. Show Pet Status"); Console.WriteLine("6. Feed all pets"); Console.WriteLine("7. Take all pets to the vet"); Console.WriteLine("8. Play with all pets"); Console.WriteLine("9. See all pets in shelter"); Console.WriteLine("10. Show status of all pets"); Console.WriteLine("11. Select A Pet"); Console.WriteLine("12. Adopt a Pet from the Shelter"); Console.WriteLine("13. Exit"); string userSelection = Console.ReadLine(); shelter.TickAllPets(); Console.Clear(); switch (userSelection) { case "1": pet.Feed(); break; case "2": pet.SeeVet(); break; case "3": pet.Play(); break; case "4": Console.WriteLine("Would you like to admit an (1)Organic Pet or a (2)Robotic Pet?"); string petType = Console.ReadLine(); if (petType == "1") { pet = new OrganicPet(); pet.CreatePet(); shelter.AddPetToShelter(pet); } else if (petType == "2") { pet = new RoboticPet(); pet.CreatePet(); shelter.AddPetToShelter(pet); } else { Console.WriteLine("Select (1) or (2)"); } break; case "5": pet.ShowPetStatus(); break; case "6": shelter.FeedAllPets(); break; case "7": shelter.SeeVetAllPets(); break; case "8": shelter.PlayAllPets(); break; case "9": shelter.SeeListOfPets(); break; case "10": shelter.SeeStatusOfPets(); break; case "11": shelter.SeeListOfPets(); Console.WriteLine("Select a pet(#)"); int petSelection = Convert.ToInt32(Console.ReadLine()); pet = shelter.SelectPet(petSelection); Console.WriteLine($"You selected {pet.Name} the {pet.Species}"); break; case "12": shelter.SeeListOfPets(); Console.WriteLine("Select a pet(#) to Adopt"); int adoptSelection = Convert.ToInt32(Console.ReadLine()); shelter.DeletePet(adoptSelection); Console.WriteLine($"You adopted {pet.Name} the {pet.Species}"); break; case "13": keepThinking = false; break; } } }
static void Main(string[] args) { VirtualPet virtualPet = new VirtualPet(); Shelter shelter = new Shelter(); Console.WriteLine("Welcome to Virtual Pets Place!"); bool inMenu = true; do { Console.WriteLine("\nEnter Number of Menu Option"); Console.WriteLine("\n1. Add Pet"); Console.WriteLine("2. Feed Pet"); Console.WriteLine("3. Play with Pet"); Console.WriteLine("4. Take Pet to Doctor"); Console.WriteLine("5. View Info of All Shelter Pets"); Console.WriteLine("6. View Status of All Shelter Pets"); Console.WriteLine("7. Feed All Pets"); Console.WriteLine("8. Play with All Pets"); Console.WriteLine("9. Maintain All Pets"); Console.WriteLine("10. Adopt a Pet"); Console.WriteLine("11. Exit Game"); Console.WriteLine(); // <---This is here to add some space between the menu and the user's input string petMenuChoice = Console.ReadLine(); switch (petMenuChoice) { case "1": Console.WriteLine("\nType your pet's name below:"); string name = Console.ReadLine(); Console.WriteLine("\nType your pet's species below:"); string species = Console.ReadLine(); Console.WriteLine("\nEnter A for an organic pet or B for a robotic pet"); string petType = Console.ReadLine().ToLower(); if (petType == "a") { VirtualPet organicPet = new OrganicPets(); organicPet.AddPet(name, species); shelter.AddPetToShelter(organicPet); } else { VirtualPet roboticPet = new RoboticPets(); roboticPet.AddPet(name, species); shelter.AddPetToShelter(roboticPet); } Console.WriteLine("\nYou've added a pet to the Shelter!"); break; case "2": virtualPet = SelectPetMenu(shelter); Console.WriteLine("\nYou've fed your pet!"); virtualPet.FeedPet(); break; case "3": virtualPet = SelectPetMenu(shelter); Console.WriteLine("\nThanks for playing with me!"); virtualPet.PlayPet(); break; case "4": virtualPet = SelectPetMenu(shelter); Console.WriteLine("\nYour pet's maintenance is A-Okay!"); virtualPet.MaintainPet(); break; case "5": Console.WriteLine("\nChecking all pets info..."); //VirtualPet petChoiceInfo = SelectPetMenu(shelter); shelter.DisplayInfoList(); break; case "6": Console.WriteLine("\nChecking all pets status..."); shelter.DisplayStatusList(); break; case "7": Console.WriteLine("\nYou've fed all your pets!"); shelter.FeedAllPets(); break; case "8": Console.WriteLine("\nThanks for playing with all your pets!"); shelter.PlayAllPets(); break; case "9": Console.WriteLine("\n The doctor says all your pets are A-Okay!"); shelter.DoctorAllPets(); break; case "10": VirtualPet petChoice = SelectPetMenu(shelter); shelter.RemovePet(petChoice); break; case "11": inMenu = false; Console.WriteLine("\nSee yah!"); break; } }while (inMenu); }