예제 #1
0
        static void Main(string[] args)
        {
            Lion   big   = new Lion("Большой лев", 50, 2001);
            Tiger  usur  = new Tiger("Усурийский", 45, 2002);
            Parrot ara   = new Parrot("Ара", 13, 2007);
            Parrot ara1  = new Parrot("Ара", 7, 2007);
            Parrot ara2  = new Parrot("Ара", 7, 2004);
            Shark  white = new Shark("Белая", 100, 1998);

            Console.WriteLine(big.Print());
            List <Animal> animals = new List <Animal>();

            animals.Add(big);
            animals.Add(usur);
            animals.Add(ara);
            animals.Add(white);
            Printer pr = new Printer();

            pr.IamPrinting(big);
            for (int i = 0; i < animals.Count; i++)
            {
                pr.IamPrinting(animals[i]);
            }
            Console.WriteLine(new string('_', 50));
            // --------------------------------------------------------------------------------------
            Workwithenum newenum   = new Workwithenum();
            Animal       newanimal = newenum.Addanimal("Новая акула", 110, 1999, Workwithenum.Animalenum.Shark);

            pr.IamPrinting(newanimal);
            Console.WriteLine(new string('_', 50));
            // --------------------------------------------------------------------------------------
            Animalstruct newstruct = new Animalstruct("Тигр", 54, 2001);

            newstruct.Printstruct();
            Console.WriteLine(new string('_', 50));
            // --------------------------------------------------------------------------------------
            Zoo zoo = new Zoo();

            zoo.Addtozoo(ara);
            zoo.Addtozoo(ara1);
            zoo.Addtozoo(ara2);
            zoo.Addtozoo(usur);
            zoo.Printzoo();
            zoo.Deletefromzoo(usur);
            zoo.Printzoo();
            zoo.Findweight(ara);
            zoo.Addtozoo(usur);
            zoo.Addtozoo(white);
            zoo.Addtozoo(big);
            Console.WriteLine(new string('_', 50));
            // --------------------------------------------------------------------------------------
            ZooController zoocontrol = new ZooController();

            zoocontrol.YearSort(zoo);
            Console.WriteLine(new string('_', 50));
            zoocontrol.SameWeightCount(zoo, 7);
            Crocodile croco = new Crocodile("крокодильчик", 5, 2012);

            croco.PartialCroco();
        }
예제 #2
0
        static void Main(string[] args)
        {
            Lion   big   = new Lion("Большой лев", 50, 2001);
            Tiger  usur  = new Tiger("Усурийский", 45, 2002);
            Parrot ara   = new Parrot("Ара", 13, 2007);
            Parrot ara1  = new Parrot("Ара", 7, 2007);
            Parrot ara2  = new Parrot("Ара", 7, 2004);
            Shark  white = new Shark("Белая", 100, 1998);

            Console.WriteLine(big.Print());
            List <Animal> animals = new List <Animal>();

            animals.Add(big);
            animals.Add(usur);
            animals.Add(ara);
            animals.Add(white);
            Printer pr = new Printer();

            pr.IamPrinting(big);
            for (int i = 0; i < animals.Count; i++)
            {
                pr.IamPrinting(animals[i]);
            }
            Console.WriteLine(new string('_', 50));
            // --------------------------------------------------------------------------------------
            Workwithenum newenum   = new Workwithenum();
            Animal       newanimal = newenum.Addanimal("Новая акула", 110, 1999, Workwithenum.Animalenum.Shark);

            pr.IamPrinting(newanimal);
            Console.WriteLine(new string('_', 50));
            // --------------------------------------------------------------------------------------
            Animalstruct newstruct = new Animalstruct("Тигр", 54, 2001);

            newstruct.Printstruct();
            Console.WriteLine(new string('_', 50));
            // --------------------------------------------------------------------------------------
            Zoo zoo = new Zoo();

            zoo.Addtozoo(ara);
            zoo.Addtozoo(ara1);
            zoo.Addtozoo(ara2);
            zoo.Addtozoo(usur);
            zoo.Printzoo();
            zoo.Deletefromzoo(usur);
            zoo.Printzoo();
            zoo.Findweight(ara);
            zoo.Addtozoo(usur);
            zoo.Addtozoo(white);
            zoo.Addtozoo(big);
            Console.WriteLine(new string('_', 50));
            // --------------------------------------------------------------------------------------
            ZooController zoocontrol = new ZooController();

            zoocontrol.YearSort(zoo);
            Console.WriteLine(new string('_', 50));
            zoocontrol.SameWeightCount(zoo, 7);
            Console.WriteLine(new string('_', 50));
            // --------------------------------------------------------------------------------------

            try
            {
                Owl an = new Owl("sdf", 3, 4);
                zoo.Findweight(an);
                Owl an1 = null;
                zoo.Findweight(an1);
                int[] arr = new int[5];
                for (int i = 0; i < arr.Length + 1; i++)
                {
                    arr[i] = Convert.ToInt32(Console.ReadLine());
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message + "+" + e.StackTrace + "." + e.TargetSite);
            }
            finally
            {
                Console.WriteLine("КОнец");
            }
        }