コード例 #1
0
ファイル: Program.cs プロジェクト: AlexanderKrustev/SoftUni
        public static void Main(string[] args)
        {
            string[] nums = Console.ReadLine().Split();
            string[] urls = Console.ReadLine().Split();
            Smartphone phone=new Smartphone(nums,urls);

            phone.Call();
            phone.Browse();
        }
コード例 #2
0
        private static void Main()
        {
            string[] phones   = Console.ReadLine().Split();
            string[] websites = Console.ReadLine().Split();

            Smartphone smartphone = new Smartphone();

            foreach (var phone in phones)
            {
                smartphone.AddPhone(phone);
            }

            foreach (var website in websites)
            {
                smartphone.AddWebsite(website);
            }

            Console.WriteLine(smartphone.Call());
            Console.WriteLine(smartphone.Browse());
        }
コード例 #3
0
        public static void Main(string[] args)
        {
            string[] phoneNumbers = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries);

            string[] websites = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries);

            Smartphone smartphone = new Smartphone();

            StationaryPhone stationary = new StationaryPhone();

            foreach (var number in phoneNumbers)
            {
                try
                {
                    string result = number.Length == 10 ? smartphone.Call(number) : stationary.Call(number);

                    Console.WriteLine(result);
                }
                catch (InvalidOperationException ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }

            foreach (var url in websites)
            {
                try
                {
                    string result = smartphone.Browse(url);

                    Console.WriteLine(result);
                }
                catch (InvalidOperationException ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }