Example #1
0
        static void Main(string[] args)
        {
            string messForPerson = "Number is prime: Input 1\n" +
                                   "Distanse between Points: Input 2\n" +
                                   "Count number in Numeral: Input 3\n" +
                                   "Exit: Input 0";


            bool flagToExit = false;

            while (!flagToExit)
            {
                Console.WriteLine(messForPerson);
                int numberFlag = ConsoleWorker.getIntegerValue();
                MathCommandAbstract command = null;
                IBaseRecirver       recirver;
                if (numberFlag == 0)
                {
                    flagToExit = true; continue;
                }
                switch (numberFlag)
                {
                case 1:
                    recirver = new NumberInfoRecirver(ConsoleWorker.getIntegerValue("Input number "));
                    command  = new NumberInfo((NumberInfoRecirver)recirver);
                    break;

                case 2:
                    recirver = new PointRecirver(ConsoleWorker.getIntegerValue("Input x1 "),
                                                 ConsoleWorker.getIntegerValue("Input y1 "),
                                                 ConsoleWorker.getIntegerValue("Input x2 "),
                                                 ConsoleWorker.getIntegerValue("Input y2 "));
                    command = new PointsWorker((PointRecirver)recirver);
                    break;

                case 3:
                    recirver = new CounterNumberInNumeralRecirver(ConsoleWorker.getIntegerValue("Input number "));
                    command  = new CounterNumberInNumeral((CounterNumberInNumeralRecirver)recirver);
                    break;
                }
                command.Execute();
                Console.WriteLine();
            }

            Console.ReadLine();
        }
 public PointsWorker(PointRecirver bs) : base(bs)
 {
     recirver = bs;
 }