Example #1
0
        public void Inverse()
        {
            Console.WriteLine("Enter positive number to inverse:");
            var taskInput = new InputIntPositiveData();
            int number    = taskInput.InputData();

            var taskRun = new InverseNumber();

            Console.WriteLine("Inverse number is " + taskRun.Inverse(number));
        }
Example #2
0
        public int InputData()
        {
            Console.WriteLine("Enter the six-digit ticket number :");
            var taskInput    = new InputIntPositiveData();
            int numberTicket = taskInput.InputData();

            do
            {
                if (numberTicket < 100000 || numberTicket > 999999)
                {
                    Console.WriteLine("Invalid input. Please, repeat the input:");
                    numberTicket = taskInput.InputData();
                }
                else
                {
                    break;
                }
            } while (true);

            return(numberTicket);
        }
Example #3
0
        public void OutputData()
        {
            var taskInput = new InputIntPositiveData();

            Console.WriteLine("Enter first positive number :");
            int numberFirst = taskInput.InputData();

            Console.WriteLine("Enter second positive number :");
            int numberSecond = taskInput.InputData();

            if (numberFirst > numberSecond)
            {
                numberFirst  ^= numberSecond;
                numberSecond ^= numberFirst;
                numberFirst  ^= numberSecond;
            }
            var taskOutput = new OutputIdenticalNumbers();

            for (int i = numberFirst; i <= numberSecond; i++)
            {
                taskOutput.OutputData(i);
            }
        }