public static void FIFOAnimalShelter()
        {
            AnimalShelter animalShelter = new AnimalShelter(new Cat("james"));

            Dog boogalou = new Dog("Boogalou");

            animalShelter.Enqueue(boogalou);
            Console.WriteLine($"A cat named {boogalou.Name} was taken into the shelter");

            Dog blackMagic = new Dog("Black Magic");

            animalShelter.Enqueue(blackMagic);
            Console.WriteLine($"A dog named {blackMagic.Name} was taken into the shelter");

            Cat garfield = new Cat("Garfield");

            animalShelter.Enqueue(boogalou);
            Console.WriteLine($"A cat named {garfield.Name} was taken into the shelter");

            Cat clover = new Cat("Clover");

            animalShelter.Enqueue(clover);
            Console.WriteLine($"A cat named {clover.Name} was taken into the shelter");

            Dog bruno = new Dog("Bruno");

            animalShelter.Enqueue(bruno);
            Console.WriteLine($"A dog named {bruno.Name} was taken into the shelter");

            Console.WriteLine("First Cat taken in: {0}", animalShelter.Dequeue().Name);
            Console.WriteLine("First selected dog in: {0}", animalShelter.Dequeue(new Dog()).Name);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            AnimalShelter shelter = new AnimalShelter();

            FIFOanimalShelter(shelter);

            Console.ReadLine();
        }
Esempio n. 3
0
        static void FIFOAnimalShelter()
        {
            AnimalShelter newShelter = new AnimalShelter();

            newShelter.Enqueue("dog");
            newShelter.Enqueue("cat");
            newShelter.Enqueue("mouse");
            Console.WriteLine(newShelter.Dequeue("cat"));
        }
        static void FIFOAnimalShelter()
        {
            Animal pet1 = new Animal("cat");
            Animal pet2 = new Animal("dog");
            Animal pet3 = new Animal("dog");
            Animal pet4 = new Animal("fish");
            Animal Pet5 = new Animal("cat");


            AnimalShelter animalShelter = new AnimalShelter(pet1);

            animalShelter.Enqueue(pet2);
            animalShelter.Enqueue(pet3);

            Console.WriteLine(animalShelter.Dequeue("dog"));
        }
Esempio n. 5
0
        public static void FIFOAnimalShelter()
        {
            Cat testCat1 = new Cat("Cat 1");
            Cat testCat2 = new Cat("Cat 2");
            Cat testCat3 = new Cat("Cat 3");
            Cat testCat4 = new Cat("Cat 4");
            Dog testDog1 = new Dog("Dog 1");
            Dog testDog2 = new Dog("Dog 2");

            AnimalShelter testShelter = new AnimalShelter(testCat1);

            testShelter.Enqueue(testCat2);
            testShelter.Enqueue(testCat3);
            testShelter.Enqueue(testDog1);
            testShelter.Enqueue(testCat4);
            testShelter.Enqueue(testDog2);
            testShelter.Print();

            Fish testFish1 = new Fish();
            Bird testBird1 = new Bird();

            Console.WriteLine("\nLet's trying adding a fish and bird and seeing if the shelter changed.");
            testShelter.Enqueue(testFish1);
            testShelter.Enqueue(testBird1);
            testShelter.Print();

            Console.WriteLine("\nLet's try to dequeue a random animal.");
            testShelter.Dequeue("unicorn");
            testShelter.Print();

            Console.WriteLine("\nLet's dequeue a dog.");
            testShelter.Dequeue("DOG");
            testShelter.Print();

            Console.WriteLine("\nWe have 3 cats in the front! Let's dequeue 2 of them.");
            testShelter.Dequeue("CaT");
            testShelter.Dequeue("cAt");
            testShelter.Print();

            Console.WriteLine("\nThere's only one dog left, but let's try to get rid of two dogs.");
            testShelter.Dequeue("DOG");
            testShelter.Print();

            testShelter.Dequeue("DOG");
            testShelter.Print();
        }
Esempio n. 6
0
        static void FIFOanimalShelter(AnimalShelter shelter)
        {
            Console.WriteLine("Shelter is empty");
            Console.WriteLine("Take dog away from empty shelter");
            shelter.Dequeue("dog");

            Console.WriteLine("Tak cat away from empty shelter");
            shelter.Dequeue("cat");


            Console.WriteLine("Add in some animals to the shelter");

            Dog nena   = new Dog("nena");
            Dog bandit = new Dog("bandit");
            Cat alpine = new Cat("alpine");
            Cat ruby   = new Cat("ruby");


            Console.WriteLine("Add these new dogs into the shelter");

            shelter.Enqueue(nena);
            Console.WriteLine($"Successfully added: {shelter.Primary.Rear.Name} the {shelter.Primary.Rear.Species} to the shelter");
            shelter.Enqueue(bandit);
            Console.WriteLine($"Successfully added: {shelter.Primary.Rear.Name} the {shelter.Primary.Rear.Species} to the shelter");
            shelter.Enqueue(alpine);
            Console.WriteLine($"Successfully added: {shelter.Primary.Rear.Name} the {shelter.Primary.Rear.Species} to the shelter");
            shelter.Enqueue(ruby);
            Console.WriteLine($"Successfully added: {shelter.Primary.Rear.Name} the {shelter.Primary.Rear.Species} to the shelter");

            Console.WriteLine("Lets adopt some animals");
            Animal adopted = shelter.Dequeue("dog");

            Console.WriteLine($"You have adopted {adopted.Name}, which is a {adopted.Species}, she was first in line");
            adopted = shelter.Dequeue("dog");

            //Animal adopted2 = shelter.Dequeue("dog");
            //Console.WriteLine($"You have adopted {adopted2.Name}, which is a {adopted2.Species}");

            //Animal adopted3 = shelter.Dequeue("cat");
            //Console.WriteLine($"You have adopted {adopted3.Name}, which is a {adopted3.Species}");
        }