static void Main(string[] args) { Pet Pet = new Pet(); Console.WriteLine("Hello! Welcome to Virtual Pets.\n"); Console.WriteLine("What's the name of your new pet?"); Pet.SetName(Console.ReadLine()); Console.WriteLine(); Console.WriteLine("What's the species of your new pet?"); Pet.SetSpecies(Console.ReadLine()); Console.WriteLine(); Console.WriteLine($"\n{Pet.GetName()} the {Pet.GetSpecies()} is here!"); bool gamePlay = true; do { ; Console.WriteLine($"Hunger is {Pet.GetHunger()}."); Console.WriteLine($"Boredom is {Pet.GetBoredom()}."); Console.WriteLine($"Health is {Pet.GetHealth()}."); Pet.Tick(); Console.WriteLine("\nWhat would you like to do with your pet?\n"); Console.WriteLine("Play with my pet - press 1"); Console.WriteLine("\nFeed my pet - press 2"); Console.WriteLine("\nTake my pet to the doctor - press 3"); Console.WriteLine("\nQuit - press 4"); string inPlay = Console.ReadLine(); Console.Clear(); switch (inPlay) { case "1": Pet.Play(); break; case "2": Pet.Feed(); break; case "3": Pet.SeeDoctor(); break; case "4": Console.WriteLine("Thanks for playing!"); gamePlay = false; break; default: Console.WriteLine("Enter a number."); break; } } while (gamePlay); }
static void Main(string[] args) { Pet myPet = new Pet(); Console.WriteLine("Hello! Welcome to Virtual Pets\n"); Console.WriteLine("You have a new Virtual Pet. What kind of pet is it?"); myPet.SetSpecies(Console.ReadLine()); Console.WriteLine("What is your pet's name?"); myPet.SetName(Console.ReadLine()); Console.WriteLine($"{myPet.GetName()} the {myPet.GetSpecies()} is ready to play with you!\n\n"); Console.WriteLine("Press any key to start playing..."); Console.ReadKey(); Console.Clear(); bool playGame = true; do { myPet.Tick(); Console.WriteLine("\nWhat would you like to do?"); Console.WriteLine("1. See my pet's status"); Console.WriteLine("2. Play with my pet."); Console.WriteLine("3. Feed my pet."); Console.WriteLine("4. Take my pet to the doctor."); Console.WriteLine("5. Quit"); string gameAction = Console.ReadLine(); Console.Clear(); switch (gameAction) { case "1": myPet.ShowStatus(); break; case "2": myPet.Play(); break; case "3": myPet.Feed(); break; case "4": myPet.SeeDoctor(); break; case "5": Console.WriteLine("Your pet will miss you! Good-bye."); playGame = false; break; default: Console.WriteLine("Please enter a valid number."); break; } } while (playGame); }