Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            List     myList     = new List();
            Elephant myElephant = new Elephant();
            Giraffe  myGiraffe  = new Giraffe();
            Coyote   myCoyote   = new Coyote();
            Seals    mySeals    = new Seals();
            Bear     myBear     = new Bear();

            myList.ShowAnimalList();
            Console.ReadKey();

            // Day loop
            int day = 0;

            while (true)
            {
                Console.Clear();
                day++;

                Console.WriteLine("Det är dag " + day + ":");
                System.Console.WriteLine("Vegetarisk kost volym: " + nrOfVeggiesLeft + "\nAnimalisk kost volym: " + nrOfMeatLeft);
                Console.WriteLine("-------");


                // LÄGG TILL DIN NYA KOD HÄR

                myBear.BearHunger();

                myElephant.ElephantHunger();

                myGiraffe.GiraffeHunger();

                myCoyote.CoyoteHunger();

                mySeals.SealHunger();

                if (nrOfMeatLeft == 0 || nrOfVeggiesLeft == 0)
                {
                    Console.Clear();
                    System.Console.WriteLine("Maten är s**t och det måste köpas in mer, ASP!");

                    Console.ReadKey();
                    break;
                }



                Console.ReadKey();
            }
        }
Ejemplo n.º 2
0
        // Menu for adding animals to the sanctuary.
        public void AnimalsMenu()
        {
            while (true)
            {
                System.Console.WriteLine("Choose what kind of species you want to add.");
                System.Console.WriteLine("1. Elephant");
                System.Console.WriteLine("2. Bear");
                System.Console.WriteLine("3. Seal");
                System.Console.WriteLine("4. Wolf");
                System.Console.WriteLine("5. Giraffe");
                System.Console.WriteLine("0. New Day");

                int userInput = Convert.ToInt32(Console.ReadLine());

                switch (userInput)
                {
                case 1:
                    Elephants elephant = new Elephants();
                    elephant.AnimalName();
                    elephant.CheckHunger();
                    sanctAnimals.Add(elephant);
                    break;

                case 2:
                    Bears bear = new Bears();
                    bear.AnimalName();
                    bear.CheckHunger();
                    sanctAnimals.Add(bear);
                    break;

                case 3:
                    Seals seal = new Seals();
                    seal.AnimalName();
                    seal.CheckHunger();
                    sanctAnimals.Add(seal);
                    break;

                case 4:
                    Wolves wolf = new Wolves();
                    wolf.AnimalName();
                    wolf.CheckHunger();
                    sanctAnimals.Add(wolf);
                    break;

                case 5:
                    Giraffes giraffe = new Giraffes();
                    giraffe.AnimalName();
                    giraffe.CheckHunger();
                    sanctAnimals.Add(giraffe);
                    break;

                case 0:
                {
                    return;
                }

                default:
                    System.Console.WriteLine("Wrong input, try again.");
                    break;
                }
            }
        }