Beispiel #1
0
        static void Main(string[] args)
        {
            bool keepGoing = true;
            int choice;

            Pet myPet = new Pet();
            myPet.Name = "Bob";

            while (keepGoing)
            {
                myPet.Age();
                choice = showMenu();
                switch (choice)
                {
                    case 0:
                        keepGoing = false;
                        break;
                    case 1:
                        Console.WriteLine(myPet.Talk());
                        break;
                    case 2:
                        myPet.Eat();
                        Console.WriteLine("you fed tour pet");
                        break;
                    case 3:
                        myPet.Play();
                        Console.WriteLine("you played with your pet");
                        break;
                    case 4:

                        Console.WriteLine("you have renamed your pet");
                        myPet.Name = Console.ReadLine();
                        break;
                    default:
                        Console.WriteLine("that was not a valid input");
                        break;
                }
            }
        }