コード例 #1
0
ファイル: CodeFile1.cs プロジェクト: zhigarevyan/univer
        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
ファイル: CodeFile1.cs プロジェクト: zhigarevyan/univer
        static void Main(string[] args)
        {
            Lion   big   = new Lion("Большой лев");
            Tiger  usur  = new Tiger("Усурийский");
            Parrot ara   = new Parrot("Ара");
            Shark  white = new Shark("Белая");

            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]);
            }
        }
コード例 #3
0
        public Animal Addanimal(string _type, int weight, int date, Animalenum en)
        {
            switch (en)
            {
            case Animalenum.Shark:
            {
                Shark newshark = new Shark(_type, weight, date);
                return(newshark);
            }

            case Animalenum.Parrot:
            {
                Parrot newParrot = new Parrot(_type, weight, date);
                return(newParrot);
            }

            case Animalenum.Lion:
            {
                Lion newLion = new Lion(_type, weight, date);
                return(newLion);
            }

            case Animalenum.Tiger:
            {
                Tiger newTiger = new Tiger(_type, weight, date);
                return(newTiger);
            }

            case Animalenum.Owl:
            {
                Owl newOwl = new Owl(_type, weight, date);
                return(newOwl);
            }

            default: { break; }
            }
            return(null);
        }
コード例 #4
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("КОнец");
            }
        }