예제 #1
0
        public void Run()
        {
            string[] numbers = Console.ReadLine().Split(" ");
            string[] sites   = Console.ReadLine().Split(" ");

            SmartPhone phone = new SmartPhone();

            for (int i = 0; i < numbers.Length; i++)
            {
                string currentNumber = numbers[i];

                try
                {
                    phone.CallNumber(currentNumber);
                }
                catch (FormatException ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }

            for (int i = 0; i < sites.Length; i++)
            {
                string currentSite = sites[i];
                try
                {
                    phone.SurfSite(currentSite);
                }
                catch (FormatException ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }
    static void Main()
    {
        List <string> numbers = Console.ReadLine().Split().Select(x => x.Trim()).ToList();
        List <string> sites   = Console.ReadLine().Split().Select(x => x.Trim()).ToList();

        SmartPhone sp = new SmartPhone();

        foreach (var number in numbers)
        {
            sp.CallNumber(number);
        }
        foreach (var site in sites)
        {
            sp.BrowseSite(site);
        }
    }
예제 #3
0
    static void Main(string[] args)
    {
        var phoneNumbers = Console.ReadLine().Split(' ');
        var siteURLs     = Console.ReadLine().Split(' ');
        var phone        = new SmartPhone();

        foreach (var number in phoneNumbers)
        {
            phone.CallNumber(number);
        }

        foreach (var url in siteURLs)
        {
            phone.BrowseSite(url);
        }
    }