Пример #1
0
    public static void Main()
    {
        Bug seth = new Bug("Seth", "Bee", new List <string>()
        {
            "Birds", "dogs"
        }, new List <string>()
        {
            "flowers", "assholes"
        });

        System.Console.WriteLine($"A {seth.Species} named {seth.Name} eats: ");
        string didEat = seth.Eat("flowers");

        System.Console.WriteLine(didEat);

        string didntEat = seth.Eat("Dogs");

        System.Console.WriteLine(didntEat);

        string predatorList = seth.PredatorList();

        System.Console.WriteLine($"{seth.Name} is afraid of: {predatorList}");

        string preyList = seth.PreyList();

        System.Console.WriteLine($"{seth.Name} likes to eat: {preyList}");
    }
Пример #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            Bug Spider = new Bug("Spider", "Palystes castaneus", new List <string>()
            {
                "Bird", "Mouse"
            }, new List <string>()
            {
                "Beetle", "Fly"
            });

            Console.WriteLine(Spider.Name);
            foreach (string prey in Spider.Prey)
            {
                Console.WriteLine(prey);
            }
            Console.WriteLine(Spider.Eat("Fly"));
        }
Пример #3
0
        static void Main(string[] args)
        {
            List <string> preds = new List <string>();

            preds.Add("Crows");
            preds.Add("Eagles");
            preds.Add("Anacondas");

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

            prey.Add("Tigers");
            prey.Add("Poisin Dart Frogs");
            prey.Add("Small People");

            Bug CripplerBug = new Bug("Crippler Bug", "AnacondaCrowalsi", preds, prey);


            Console.WriteLine(CripplerBug.FormalName);
            Console.WriteLine(CripplerBug.PredatorList);
            Console.WriteLine(CripplerBug.PreyList);
            Console.WriteLine(CripplerBug.Eat("Tigers"));
        }