示例#1
0
        public static void Main(string[] args)
        {
            string[] numbers = Console.ReadLine().Split();
            string[] urls    = Console.ReadLine().Split();

            Smartphone      smartphone = new Smartphone();
            StationaryPhone statPhone  = new StationaryPhone();

            foreach (string number in numbers)
            {
                if (number.Length == 10)
                {
                    smartphone.Call(number);
                }
                else
                {
                    statPhone.Call(number);
                }
            }

            foreach (string url in urls)
            {
                smartphone.Browse(url);
            }
        }
示例#2
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);
                }
            }
        }