예제 #1
0
        static void Main(string[] args)
        {
            var predator = new List <string> {
                "birds", " frogs"
            };
            var prey = new List <string> {
                "crops", " flowers", " grass"
            };
            var bug = new Bug("buggy", "beetle", predator, prey);

            Console.WriteLine(bug);
            Console.ReadLine();

            Console.WriteLine(bug.FormalName);
            Console.ReadLine();

            Console.WriteLine(bug.PreyList());
            Console.ReadLine();

            Console.WriteLine(bug.PredatorList());
            Console.ReadLine();

            Console.WriteLine(bug.Eat("grass"));
            Console.ReadLine();
        }
예제 #2
0
        static void Main(string[] args)
        {
            var preds = new List <string>()
            {
                "Rinne",
                "Jose",
                "Saros"
            };

            var prey = new List <string>()
            {
                "Kane",
                "Toews",
                "Dach"
            };

            var dooDoo = new Bug("Poo", "Dangerous", preds, prey);

            Console.WriteLine($"This is the name of the bug: {dooDoo.Name}");
            Console.WriteLine($"THis is the species of the bug: {dooDoo.Species}");
            Console.WriteLine($"This is the list of prey: {dooDoo.PreyList()}");
            Console.WriteLine($"This is the list of predators: {dooDoo.PredatorList()}");

            Console.ReadLine();
        }
예제 #3
0
        static void Main(string[] args)
        {
            var preds = new List <string>
            {
                "bats",
                "freakin dinosaurs, man"
            };
            var preys = new List <string>
            {
                "hopes",
                "dreams"
            };
            var nigel = new Bug("Nigel", "LIGHTNING BUG", preds, preys);

            Console.WriteLine($"{nigel.Name} is a {nigel.Species}");
            Console.WriteLine($"What should {nigel.Name} eat? (he likes {nigel.PreyList()})");
            var whatNigelShouldEat = Console.ReadLine();

            Console.WriteLine(nigel.Eat(whatNigelShouldEat));

            var llewellyn = new Bug("Llewellyn", "jitterbug", preys, preds);

            Console.WriteLine($"{llewellyn.Name} is a {llewellyn.Species}");
            Console.WriteLine($"What should {llewellyn.Name} eat? (he likes {llewellyn.PreyList()})");
            var whatLlewellynShouldEat = Console.ReadLine();

            Console.WriteLine(llewellyn.Eat(whatLlewellynShouldEat));
            Console.ReadLine();
        }
예제 #4
0
        static void Main(string[] args)
        {
            Bug mantis = new Bug("Scyther", "Praying Mantis", new List <string> {
                "Eagle", "Praying Mantis", "Crab"
            }, new List <string> {
                "Praying Mantis", "Beetle", "Ladybug"
            });

            mantis.PreyList();
            mantis.PredatorList();

            Console.WriteLine(mantis.Eat("Praying Mantis"));
        }
예제 #5
0
        static void Main(string[] args)
        {
            Bug bug1 = new Bug("Ladybug", "Insect", new List <string> {
                "Lizard", "spider"
            }, new List <string> {
                "mites", "aphids"
            });

            Console.WriteLine(bug1.FormalName);
            Console.WriteLine(bug1.PreyList());
            Console.WriteLine(bug1.PredatorList());
            Console.WriteLine(bug1.Eat("pizza"));
            Console.WriteLine(bug1.Eat("mites"));
        }
예제 #6
0
        static void Main(string[] args)
        {
            var hornedBeetlePredators = new List <string>()
            {
                "click beetles",
                "flat bark beetles",
                "clerid beetles",
                "ambush bugs",
                "thrips",
                "assassin bugs",
                "carpenter ants",
                "wasps"
            };

            var hornedBeetlePrey = new List <string>()
            {
                "birch",
                "chestnut",
                "green ash",
                "maple"
            };

            var mantisPredators = new List <string>()
            {
                "frogs",
                "bats",
                "monkeys",
                "larger birds",
                "spiders",
                "snakes"
            };

            var mantisPrey = new List <string>()
            {
                "lizards",
                "crickets",
                "moths",
                "flies",
                "flour worms",
                "other large insects they can catch"
            };

            var beetle = new Bug("Horned Beetle", "Anoplophora glabripennis", hornedBeetlePredators, hornedBeetlePrey);
            var mantis = new Bug("Dead Leaf Mantis", "Deroplatys desiccata", mantisPredators, mantisPrey);

            Console.WriteLine(beetle.Eat("maple"));
            Console.WriteLine(mantis.Eat("steak"));
            Console.WriteLine($"{mantis.FormalName} loves to eat {mantis.PreyList()}");
            Console.WriteLine($"Take cover {beetle.FormalName}! Here come the {beetle.PredatorList()}");
        }
예제 #7
0
        static void Main(string[] args)
        {
            var myBugsPreds = new List <string>()
            {
                "Pred A", "Pred B", "Pred C"
            };
            var myBugsPrey = new List <string>()
            {
                "Prey A", "Prey B", "Prey C"
            };
            var myBug = new Bug("My Bug", "It's Species", myBugsPreds, myBugsPrey);

            var preyList = myBug.PreyList();
            var predList = myBug.PredatorList();

            Console.WriteLine(preyList);
            Console.WriteLine(predList);

            var prey = "Prey B";

            Console.WriteLine(myBug.Eat(prey));
        }
예제 #8
0
        static void Main(string[] args)
        {
            var predatorsForBug1 = new List <string>()
            {
                "Human", "Raid"
            };

            predatorsForBug1.Add("Dinosaurs");

            var preyForBug1 = new List <string>()
            {
                "Fly",
                "Caterpillar"
            };

            var bug1 = new Bug("Black Widow", "Spider", predatorsForBug1, preyForBug1);

            Console.WriteLine(bug1.PredatorList());
            Console.WriteLine(bug1.PreyList());
            Console.WriteLine(bug1.Eat("Fly"));

            var predatorsForBug2 = new List <string>()
            {
                "Human", "Mouse", "Bat"
            };
            var preyForBug2 = new List <string>()
            {
                "Spiders", "Lizards"
            };

            var bug2 = new Bug("King Scorpio", "scorpion", predatorsForBug2, preyForBug2);

            Console.WriteLine(bug2.PredatorList());
            Console.WriteLine(bug2.PreyList());
            Console.WriteLine(bug2.Eat("Fly"));
        }