static void Main(string[] args) { string[] numbers = Console.ReadLine().Split(); string[] urls = Console.ReadLine().Split(' '); Smartphone smartphone = new Smartphone(); StationaryPhone stationary = new StationaryPhone(); foreach (var number in numbers) { try { if (number.Length == 10) { smartphone.Calling(number); } else if (number.Length == 7) { stationary.Calling(number); } } catch (InvalidOperationException ex) { Console.WriteLine(ex.Message); } } foreach (var url in urls) { try { smartphone.Browse(url); } catch (InvalidOperationException ex) { Console.WriteLine(ex.Message); } } }
static void Main(string[] args) { string[] numbers = Console.ReadLine().Split(); string[] webs = Console.ReadLine().Split(); Smartphone smart = new Smartphone(); StationaryPhone stat = new StationaryPhone(); foreach (var item in numbers) { if (item.Length == 10) { Console.WriteLine(smart.Call(item)); } else { Console.WriteLine(stat.Call(item)); } } foreach (var item in webs) { Console.WriteLine(smart.Browsing(item)); } }