Example #1
0
        static void Main(string[] args)
        {
            List <string> numbers = Console.ReadLine().Split().ToList();
            List <string> sites   = Console.ReadLine().Split().ToList();

            var smartphone = new Smartphone();

            numbers.ForEach(x =>
            {
                try
                {
                    Console.WriteLine(smartphone.Calling(x));
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
                            );
            sites.ForEach(x =>
            {
                try
                {
                    Console.WriteLine(smartphone.Browse(x));
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
                          );
        }
 private static void BrowseWeb(string[] webSites, Smartphone phone)
 {
     foreach (var site in webSites)
     {
         try
         {
             Console.WriteLine(phone.Browse(site));
         }
         catch (ArgumentException ex)
         {
             Console.WriteLine(ex.Message);
         }
     }
 }
Example #3
0
        static void Main(string[] args)
        {
            var phone        = new Smartphone();
            var phoneNumbers = Console.ReadLine().Split();
            var sites        = Console.ReadLine().Split();

            if (phoneNumbers.Length > 0)
            {
                phone.Call(phoneNumbers);
            }

            if (sites.Length > 0)
            {
                phone.Browse(sites);
            }
        }