Пример #1
0
        static void Main(string[] args)
        {
            string[]        numbers         = Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries);
            Smartphone      smartphone      = new Smartphone();
            StationaryPhone stationaryPhone = new StationaryPhone();

            foreach (string number in numbers)
            {
                try
                {
                    if (number.Length == 10)
                    {
                        Console.WriteLine(smartphone.Call(number));
                    }
                    else
                    {
                        Console.WriteLine(stationaryPhone.Call(number));
                    }
                }
                catch (InvalidOperationException ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }

            string[] urls = Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries);
            foreach (string url in urls)
            {
                try
                {
                    Console.WriteLine(smartphone.Browse(url));
                }
                catch (InvalidOperationException ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }