Exemplo n.º 1
0
        public static void Main()
        {
            Random Rand = new Random();
            Boss   BB = new Boss();
            int    H, V = 0;
            int    Try = 1;

            BB.Run    += BB.EventRun;
            BB.Broken += BB.EventBreak;
            while (V < 9)
            {
                Console.WriteLine("Включить питание?");
                Console.ReadKey();
                Console.Clear();
                Console.WriteLine($" Попытка №{Try}");
                BB.TurnOn(V = Rand.Next(6, 13));
                Try++;
            }
            Damage D = new Damage();

            D.Check += D.Show;
            DELEG DamageT = D.Tech;

            Tech T = new Tech(H = Rand.Next(3, 6));

            Console.WriteLine("Нанести случайный урон Tech->");
            Console.ReadKey();
            int t = DamageT();

            T.GetDmg(t);

            Human Hum = new Human(H = Rand.Next(3, 6));

            Console.WriteLine("Нанести случайный урон Tech->");
            Console.ReadKey();
            DELEG DamageH = D.Human;
            int   h       = DamageH();

            Hum.GetDmg(h);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Product product = new Product("123", "213", 100);
            Tech    tech    = new Tech("456", "789", "456789", 200);
            Tablet  tablet  = new Tablet();
            Lab     lab     = new Lab(10);

            tablet.info.price = 300;
            lab.Add(product);
            lab.Add(tech);
            lab.Add(tablet);
            lab.Add(new Scanner());
            lab.Add(new Printer());
            lab.Add(new Product());

            lab.show();
            controller.show(lab);
            controller.sort(lab);
            lab.show();
            lab.Del(tablet);
            lab.show();
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Product      product     = new Product("123", "213");
            Tech         tech        = new Tech("456", "789", "456789");
            Tablet       tablet      = new Tablet();
            IMyInterface myInterface = tablet;

            IAnotherInterface[] arr = new IAnotherInterface[3];
            arr[0] = product;
            arr[1] = tech;
            arr[2] = tablet;

            Console.WriteLine(product.ToString());
            Console.WriteLine(tech.ToString());
            Console.WriteLine(tablet.MyFunc());
            Console.WriteLine(myInterface.MyFunc());
            Console.WriteLine($"myInterface is IMyInterface = {myInterface is IMyInterface}");
            Console.WriteLine($"myInterface is Tabet = {myInterface is Tablet}");
            foreach (IAnotherInterface x in arr)
            {
                Print.IAmPrinting(x);
            }
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            Product product = new Product("123", "213", 100);
            Tech    tech    = new Tech("456", "789", "456789", 200);
            Tablet  tablet  = new Tablet();
            Lab     lab     = new Lab(6);
            Scanner scanner = new Scanner("2223", "32131", "11123", "231", 22360);

            tablet.info.price = 300;
            IAnotherInterface[] arr = new IAnotherInterface[3];
            arr[0] = product;
            arr[1] = tech;
            arr[2] = tablet;

            try
            {
                Lab WrongLab = new Lab(100);
                WrongLab.Del(tablet);
                //arr[4].ToString();
                lab.Add(product);
                lab.Add(tech);
                lab.Add(tablet);
                lab.Add(new Scanner());
                lab.Add(new Printer());
                lab.Add(new Product());
                //lab.Add(new Product());


                lab.show();
                controller.show(lab);
                controller.sort(lab);
                lab.show();
                lab.Del(tablet);
                //lab.Del(scanner);
                lab.show();
            }
            catch (LabIsFull ex)
            {
                Console.WriteLine("LabIsFull Exception");
                Console.WriteLine(ex.Message);
            }
            catch (ElementDoesNotExist ex)
            {
                Console.WriteLine("ElementDoesNotExist Exception");
                Console.WriteLine(ex.Message);
            }
            catch (LabIsEmpty ex)
            {
                Console.WriteLine("LabIsEmpty Exception");
                Console.WriteLine(ex.Message);
            }
            catch (WrongSize ex)
            {
                Console.WriteLine("WrongSize Exception");
                Console.WriteLine(ex.Message);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Another Exception");
                Console.WriteLine(ex.Message);
            }
        }