Exemplo n.º 1
0
        public static void Main()
        {
            var phone = new Smartphone();

            Console.ReadLine().
            Split(' ', StringSplitOptions.RemoveEmptyEntries).
            ToList().
            ForEach(num => phone.Call(num));

            Console.ReadLine().
            Split(' ', StringSplitOptions.RemoveEmptyEntries).
            ToList().
            ForEach(site => phone.Browse(site));
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Smartphone smartphone = new Smartphone();

            ICaller caller = smartphone;

            string[] phoneNumbers = Console.ReadLine().Split();
            caller.Call(phoneNumbers);

            IBrowser browser = smartphone;

            string[] urls = Console.ReadLine().Split();
            browser.Browse(urls);
        }
Exemplo n.º 3
0
        public static void Main(string[] args)
        {
            string[]   phoneNumbers = Console.ReadLine().Split(" ");
            string[]   sites        = Console.ReadLine().Split(" ");
            Smartphone smartphone   = new Smartphone();

            foreach (var item in phoneNumbers)
            {
                Console.WriteLine(smartphone.Call(item));
            }
            foreach (var item in sites)
            {
                Console.WriteLine(smartphone.Browse(item));
            }
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            var numbers    = Console.ReadLine().Split();
            var url        = Console.ReadLine().Split();
            var smatrphone = new Smartphone();

            foreach (var number in numbers)
            {
                Console.WriteLine(smatrphone.Call(number));
            }
            foreach (var s in url)
            {
                Console.WriteLine(smatrphone.Browsing(s));
            }
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            var        phoneNumInput = Console.ReadLine().Split();
            var        URLInput      = Console.ReadLine().Split();
            Smartphone smartphone    = new Smartphone();

            for (int i = 0; i < phoneNumInput.Length; i++)
            {
                smartphone.Calling(phoneNumInput[i]);
            }
            for (int i = 0; i < URLInput.Length; i++)
            {
                smartphone.Browse(URLInput[i]);
            }
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            string[] numbers = Console.ReadLine().Split(' ');
            string[] links   = Console.ReadLine().Split(' ');
            var      smFone  = new Smartphone();

            for (int i = 0; i < numbers.Length; i++)
            {
                Console.WriteLine(smFone.Call(numbers[i]));
            }
            foreach (var url in links)
            {
                Console.WriteLine(smFone.Browse(url));
            }
        }
Exemplo n.º 7
0
        static void Main(string[] args)
        {
            string[] phoneNumber = Console.ReadLine()
                                   .Split(' ')
                                   .ToArray();
            string[] sites = Console.ReadLine()
                             .Split(' ')
                             .ToArray();

            Smartphone      smartPhone       = new Smartphone();
            StationaryPhone stattionaryPhone = new StationaryPhone();

            NumberCaller(smartPhone, stattionaryPhone, phoneNumber);
            Browser(smartPhone, sites);
        }
Exemplo n.º 8
0
        static void Main(string[] args)
        {
            List <string> numbers = Console.ReadLine()
                                    .Split()
                                    .ToList();

            List <string> sites = Console.ReadLine()
                                  .Split()
                                  .ToList();

            Smartphone phone = new Smartphone(numbers, sites);

            phone.Call();
            phone.Browse();
        }
Exemplo n.º 9
0
        static void Main(string[] args)
        {
            string[]   inputNumbers = Console.ReadLine().Split(" ");
            Smartphone smartphone   = new Smartphone();

            for (int i = 0; i < inputNumbers.Length; i++)
            {
                Console.WriteLine(smartphone.Call(inputNumbers[i]));
            }
            string[] inputWebsites = Console.ReadLine().Split();
            for (int i = 0; i < inputWebsites.Length; i++)
            {
                Console.WriteLine(smartphone.Browse(inputWebsites[i]));
            }
        }
Exemplo n.º 10
0
        static void Main(string[] args)
        {
            var        numbers    = Console.ReadLine().Split(' ');
            var        sites      = Console.ReadLine().Split(' ');
            Smartphone smartphone = new Smartphone();

            foreach (var num in numbers)
            {
                Console.WriteLine(smartphone.CallPhonenumber(num));
            }
            foreach (var site in sites)
            {
                Console.WriteLine(smartphone.Browse(site));
            }
        }
Exemplo n.º 11
0
        static void Main(string[] args)
        {
            Smartphone smartphone = new Smartphone();

            string[] phones = Console.ReadLine().Split();
            foreach (var phone in phones)
            {
                Console.WriteLine(smartphone.Call(phone));
            }
            string[] urls = Console.ReadLine().Split();
            foreach (var url in urls)
            {
                Console.WriteLine(smartphone.Browse(url));
            }
        }
Exemplo n.º 12
0
        static void Main(string[] args)
        {
            string[]   phoneNumbers = Console.ReadLine().Split();
            string[]   sites        = Console.ReadLine().Split();
            Smartphone sp           = new Smartphone();

            foreach (string number in phoneNumbers)
            {
                Console.WriteLine(sp.Calling(number));
            }
            foreach (string site in sites)
            {
                Console.WriteLine(sp.Browsing(site));
            }
        }
Exemplo n.º 13
0
        public static void Main()
        {
            string[]   numbers    = Console.ReadLine().Split();
            string[]   sites      = Console.ReadLine().Split();
            Smartphone smartphone = new Smartphone();

            foreach (var number in numbers)
            {
                Console.WriteLine(smartphone.Calling(number));
            }

            foreach (var site in sites)
            {
                Console.WriteLine(smartphone.Browsing(site));
            }
        }
Exemplo n.º 14
0
        public static void Main()
        {
            Smartphone phone = new Smartphone();

            string[] phoneNumbers = Console.ReadLine().Split(" ");
            string[] webSites     = Console.ReadLine().Split(" ");
            for (int i = 0; i < phoneNumbers.Length; i++)
            {
                Console.WriteLine(phone.Call(phoneNumbers[i]));
            }

            for (int i = 0; i < webSites.Length; i++)
            {
                Console.WriteLine(phone.Browse(webSites[i]));
            }
        }
Exemplo n.º 15
0
        static void Main(string[] args)
        {
            var phoneNumbers = Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries);
            var webSites     = Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries);
            var smartphone   = new Smartphone();

            foreach (var number in phoneNumbers)
            {
                smartphone.Call(number);
            }

            foreach (var website in webSites)
            {
                smartphone.Browse(website);
            }
        }
Exemplo n.º 16
0
        static void Main(string[] args)
        {
            var tele = new Smartphone();

            string[] numbers = Console.ReadLine().Split();
            string[] urls    = Console.ReadLine().Split();

            foreach (var number in numbers)
            {
                Console.WriteLine(tele.Call(number));
            }
            foreach (var url in urls)
            {
                Console.WriteLine(tele.Browse(url));
            }
        }
Exemplo n.º 17
0
        static void Main(string[] args)
        {
            var numbers = Console.ReadLine().Split().ToArray();

            var webSites = Console.ReadLine().Split().ToArray();

            ISmartphone smartphone = new Smartphone();

            IStationaryPhone stationaryPhone = new StationaryPhone();

            for (int i = 0; i < numbers.Length; i++)
            {
                try
                {
                    if (numbers[i].Length == 10)
                    {
                        smartphone.Call(numbers[i]);
                    }
                    else if (numbers[i].Length == 7)
                    {
                        stationaryPhone.Dialing(numbers[i]);
                    }
                }

                catch (ArgumentException ae)
                {
                    Console.WriteLine(ae.Message);
                }
            }

            for (int i = 0; i < webSites.Length; i++)
            {
                try
                {
                    smartphone.Browse(webSites[i]);
                }
                catch (ArgumentException ae)
                {
                    Console.WriteLine(ae.Message);
                }
            }

            if (webSites.Length == 0)
            {
                Console.WriteLine("Invalid URL!");
            }
        }
Exemplo n.º 18
0
        public static void Main(string[] args)
        {
            string[] numbers = Console.ReadLine()
                               .Split(" ")
                               .ToArray();

            string[] urls = Console.ReadLine()
                            .Split(" ")
                            .ToArray();

            foreach (var number in numbers)
            {
                try
                {
                    if (number.Length == 7)
                    {
                        StationatyPhone stationatyPhone = new StationatyPhone();
                        Console.WriteLine(stationatyPhone.Call(number));
                    }
                    else if (number.Length == 10)
                    {
                        Smartphone smartphone = new Smartphone();
                        Console.WriteLine(smartphone.Call(number));
                    }
                    else
                    {
                        throw new InvalidCallNumber();
                    }
                }
                catch (InvalidCallNumber iue)
                {
                    Console.WriteLine(iue.Message);
                }
            }
            foreach (var url in urls)
            {
                try
                {
                    Smartphone smartphone = new Smartphone();
                    Console.WriteLine(smartphone.Browse(url));
                }
                catch (InvalidUrlException iue)
                {
                    Console.WriteLine(iue.Message);
                }
            }
        }
Exemplo n.º 19
0
        static void Main(string[] args)
        {
            string[]   numbersToCall = Console.ReadLine().Split();
            string[]   sites         = Console.ReadLine().Split();
            Smartphone smartphone    = new Smartphone();

            foreach (var item in numbersToCall)
            {
                bool isValid = true;
                foreach (var digit in item)
                {
                    if (!char.IsDigit(digit))
                    {
                        isValid = false;
                    }
                }
                if (isValid)
                {
                    Console.WriteLine($"{smartphone.Call()}{item}");
                }
                else
                {
                    Console.WriteLine("Invalid number!");
                }
            }

            foreach (var item in sites)
            {
                bool isValid = true;
                foreach (var letter in item)
                {
                    if (char.IsDigit(letter))
                    {
                        isValid = false;
                    }
                }

                if (isValid)
                {
                    Console.WriteLine($"{smartphone.Browse()}{item}!");
                }
                else
                {
                    Console.WriteLine("Invalid URL!");
                }
            }
        }
Exemplo n.º 20
0
        static void Main()
        {
            var phone = new Smartphone();

            var numbers = Console.ReadLine().Split();
            var urls    = Console.ReadLine().Split();

            foreach (var number in numbers)
            {
                phone.Call(number);
            }

            foreach (var url in urls)
            {
                phone.Browse(url);
            }
        }
Exemplo n.º 21
0
 private static void PrintNumbers(string[] phoneNumbers)
 {
     foreach (var phoneNumber in phoneNumbers)
     {
         try
         {
             Smartphone smartPhone = new Smartphone {
                 Number = phoneNumber
             };
             Console.WriteLine(smartPhone.CallNumber());
         }
         catch (ArgumentException message)
         {
             Console.WriteLine(message.Message);
         }
     }
 }
Exemplo n.º 22
0
        public static void Main()
        {
            Smartphone smartphone = new Smartphone();

            string[] phoneNumbers = Console.ReadLine().Split();
            string[] urls         = Console.ReadLine().Split();

            foreach (string number in phoneNumbers)
            {
                Console.WriteLine(smartphone.Call(number));
            }

            foreach (string url in urls)
            {
                Console.WriteLine(smartphone.Browse(url));
            }
        }
Exemplo n.º 23
0
        public static void Main(string[] args)
        {
            Smartphone smartphone = new Smartphone();

            string[] inputNumbers = Console.ReadLine().Split();
            string[] inputUrls    = Console.ReadLine().Split();

            for (int i = 0; i < inputNumbers.Length; i++)
            {
                smartphone.Call(inputNumbers[i]);
            }

            for (int i = 0; i < inputUrls.Length; i++)
            {
                smartphone.Browse(inputUrls[i]);
            }
        }
Exemplo n.º 24
0
        public static void Main(string[] args)
        {
            string[] numbersToCall    = Console.ReadLine().Split();
            string[] websitesToBrowse = Console.ReadLine().Split();

            Smartphone smartPhone = new Smartphone();

            for (int i = 0; i < numbersToCall.Length; i++)
            {
                Console.WriteLine(smartPhone.Call(numbersToCall[i]));
            }

            for (int i = 0; i < websitesToBrowse.Length; i++)
            {
                Console.WriteLine(smartPhone.Browse(websitesToBrowse[i]));
            }
        }
Exemplo n.º 25
0
        static void Main(string[] args)
        {
            ISmartphonable      smartphone = new Smartphone();
            IStationaryPhonable stacionary = new Stacionary();

            string[] inputNumbers = Console.ReadLine().Split();

            string pattern      = @"(\b\d{10}\b)|(\b\d{7}\b)";
            Regex  phoneNumbers = new Regex(pattern);

            foreach (var item in inputNumbers)
            {
                if (phoneNumbers.IsMatch(item))
                {
                    if (item.Length == 7)
                    {
                        stacionary.Dialing(item.ToString());
                    }
                    else
                    {
                        smartphone.Calling(item.ToString());
                    }
                }
                else
                {
                    Console.WriteLine("Invalid number!");
                }
            }

            string[] inputSites = Console.ReadLine().Split();

            string patternSites = @"(\b[a-zA-Z]+:\/\/[a-zA-Z]+\.[a-zA-Z]+\.[a-zA-Z]+\b)|(\b[a-zA-Z]+\.[a-zA-Z]+\.[a-zA-Z]+\b)|(\b[a-zA-Z]+:\/\/[a-zA-Z]+\.[a-zA-Z]+\b)|(\b[a-zA-Z]+\.[a-zA-Z]+\b)";
            Regex  sites        = new Regex(patternSites);

            foreach (var item in inputSites)
            {
                if (sites.IsMatch(item))
                {
                    smartphone.Browsing(item.ToString());
                }
                else
                {
                    Console.WriteLine("Invalid URL!");
                }
            }
        }
Exemplo n.º 26
0
        static void Main(string[] args)
        {
            string[] phoneNumbers = Console.ReadLine().Split();
            string[] urls         = Console.ReadLine().Split();

            Smartphone phone = new Smartphone();

            foreach (var phoneNumber in phoneNumbers)
            {
                Console.WriteLine(phone.CallPhoneNumber(phoneNumber));
            }

            foreach (var url in urls)
            {
                Console.WriteLine(phone.BrowsePage(url));
            }
        }
Exemplo n.º 27
0
        public static void Main(string[] args)
        {
            string[] numbers = Console.ReadLine().Split(new [] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            string[] urls    = Console.ReadLine().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            Smartphone smartphone = new Smartphone();

            foreach (var number in numbers)
            {
                Console.WriteLine(smartphone.Call(number));
            }

            foreach (var url in urls)
            {
                Console.WriteLine(smartphone.Browse(url));
            }
        }
        static void Main(string[] args)
        {
            var numbers = Console.ReadLine().Split();
            var urls    = Console.ReadLine().Split();

            foreach (var number in numbers)
            {
                ICallable smartphone = new Smartphone();
                Console.WriteLine(smartphone.Call(number));
            }

            foreach (var url in urls)
            {
                IBrowsable smartphone = new Smartphone();
                Console.WriteLine(smartphone.Browse(url));
            }
        }
Exemplo n.º 29
0
        static void Main(string[] args)
        {
            string[] telephoneNumbers = Console.ReadLine().Split(" ");
            string[] urlAdreses       = Console.ReadLine().Split(" ");

            Smartphone smartphone = new Smartphone();

            foreach (string number in telephoneNumbers)
            {
                Console.WriteLine(smartphone.Call(number));
            }

            foreach (string url in urlAdreses)
            {
                Console.WriteLine(smartphone.Browse(url));
            }
        }
Exemplo n.º 30
0
        public static void Main(string[] args)
        {
            var numbers = Console.ReadLine().Split();
            var sites   = Console.ReadLine().Split();

            Smartphone phone = new Smartphone();

            foreach (var number in numbers)
            {
                Console.WriteLine(phone.Call(number));
            }

            foreach (var site in sites)
            {
                Console.WriteLine(phone.Browse(site));
            }
        }