Exemple #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("----------- Б Р У С Ь Я ------------");
            Playground brus = new Beams(10);

            brus.GetExp();
            brus.DoExercise();
            brus.DoExercise();
            brus.Relax(10);
            brus.GetExp();
            if (brus is Playground)
            {
                Console.WriteLine($"{brus} is Playground ");    //true
            }

            Console.WriteLine("\n\n--------- С К А М Е Й К А --------");
            Playground skam = new Bench();

            skam.DoExercise();
            skam.Relax(30);
            if (skam is Beams)
            {
                Console.WriteLine($"{skam} is Beams ");         //false
            }

            Console.WriteLine("\n\n--------- М А Т Ы -----------");
            Playground mat = new Mats();

            mat.DoExercise();
            mat.Relax(2);

            Console.WriteLine("\n\n---------- Б А С К Е Т Б О Л -----------");
            Basketball  bask      = new Basketball();
            IBasketBall bask_ball = bask;

            bask.Take_Invent();
            bask.DoExercise();
            bask.Play();
            bask.Throw();
            bask.Back_Invent();
            bask.GetExp();
            if (bask_ball as Beams != null)
            {
                Console.WriteLine($"{bask_ball} as Beams ");        //false
            }
            if (bask_ball as Playground != null)
            {
                Console.WriteLine($"{bask_ball} as Playground ");   //true
            }

            Console.WriteLine("\n\n---------- Т Е Н Н И С ----------");
            Tennis      ten      = new Tennis();
            ITennisBall ten_ball = ten;

            ten.DoExercise();           //а.к.
            ten_ball.DoExercise();      //интер.
            Console.ReadLine();
        }
Exemple #2
0
        //переопределение методов object (в 1 классе)
        public override bool Equals(object obj)
        {
            if (obj.GetType() != GetType())
            {
                return(false);
            }
            Tennis other = (Tennis)obj;

            return(Exp == other.Exp);
        }
Exemple #3
0
        static void Main(string[] args)
        {
            Tennis ten = new Tennis();

            ten.ChooseRocket(Tennis.enumRocket.x);

            Gym gym = new Gym();

            Playground[] arrPlaygrounds = { new Tennis(), new Basketball(), new Beams(10), new Bench(), new Mats() };
            foreach (var i in arrPlaygrounds)
            {
                gym.Add(i);
            }
            gym.Show();
            gym.Remove(2);
            gym.Remove(6);//f
            gym.Show();

            СontrollerGym cg = new СontrollerGym(30000);//бюджет

            Console.WriteLine("Количество снарядов:   |   Цена (каждый 12 руб):");
            cg.Add(new Shells(100));
            cg.Add(new Shells(90));
            cg.Add(new Shells(80));
            cg.Add(new Shells(166));
            cg.Add(new Shells(45));
            cg.Show();

            Console.WriteLine("_________________________________________________");
            Console.WriteLine("\nПосле сортировки:");
            cg.Sort();
            cg.Show();

            Console.WriteLine("_________________________________________________");
            Console.WriteLine("\nВ диапазоне цены 500-1000:");
            cg.СhoiceRange(500, 1000);
            cg.Show();
            Console.ReadLine();
        }