Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var caterpillarPreds = new List <string> {
                "Birds", "Groundhogs"
            };
            var caterpillarPrey = new List <string> {
                "Leaves", "Microscopic bois"
            };
            var caterpillar = new Bug("Squirmy", "Caterpillar", caterpillarPreds, caterpillarPrey);

            Console.WriteLine(caterpillar.FormalName);
            Console.WriteLine(caterpillar.PreyList());
            Console.WriteLine(caterpillar.PredatorList());
            Console.WriteLine(caterpillar.Eat("Leaves"));
            Console.ReadLine();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            List <string> Prey = new List <string>();

            Prey.Add("Thing1");
            Prey.Add("Thing2");
            Prey.Add("Thing3");

            List <string> Predator = new List <string>();

            Predator.Add("Enemy1");
            Predator.Add("Enemy2");
            Predator.Add("Enemy3");

            Bug bug1 = new Bug("Steven", "Humanoid", Predator, Prey);

            Console.WriteLine(bug1.PreyList());
            Console.WriteLine(bug1.PredatorList());
            Console.WriteLine(bug1.Eat("Thing1"));
        }