static void Main(string[] args) { // We create our Zoo and our Animals Zoo zoo = new Zoo(); List <Animal> animals = new List <Animal>() { new Monkey(), new Monkey(), new Monkey(), new Monkey(), new Monkey(), new Elephant(), new Elephant(), new Elephant(), new Elephant(), new Elephant(), new Lion(), new Lion(), new Lion(), new Lion(), new Lion() }; // We make the operations to animals which are allowed in our Zoo zoo.Eat(animals); zoo.Starvation(animals); zoo.Starvation(animals); zoo.Starvation(animals); zoo.Starvation(animals); zoo.Starvation(animals); zoo.Eat(animals); zoo.Starvation(animals); zoo.Starvation(animals); zoo.Starvation(animals); // We get the alived animals after the operations int countAlivedAnimals = zoo.GetAliveAnimals(animals); Console.WriteLine($"The count of alived animals is {countAlivedAnimals}"); }
static void Main(string[] args) { Random r = new Random(); var zoo = new Zoo(); var animals = new List <Animal> { new Lion(), new Lion(), new Lion(), new Lion(), new Lion(), new Elephant(), new Elephant(), new Elephant(), new Elephant(), new Elephant(), new Monkey(), new Monkey(), new Monkey(), new Monkey(), new Monkey(), }; zoo.AddAnimals(animals); zoo.Starvation(r); zoo.Starvation(r); zoo.Feeding(); zoo.Feeding(); zoo.Feeding(); Console.WriteLine(zoo.Count()); }