Beispiel #1
0
        static void Main(string[] args)
        {
            ISmartphone smartphone = new Smartphone();

            smartphone.Calling();
            smartphone.Browsing();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            var numbers = Console.ReadLine().Split();
            var urls    = Console.ReadLine().Split();

            Smartphone      smartphone = new Smartphone();
            StationaryPhone stationary = new StationaryPhone();

            foreach (var num in numbers)
            {
                if (num.Length == 7)
                {
                    Console.WriteLine(stationary.Calling(num));
                }
                else if (num.Length == 10)
                {
                    Console.WriteLine(smartphone.Calling(num));
                }
                else
                {
                    Console.WriteLine("Invalid number!");
                }
            }
            foreach (var url in urls)
            {
                Console.WriteLine(smartphone.Browsing(url));
            }
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            string[] numbers = Console.ReadLine().Split(' ').ToArray();

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

            Smartphone smartphone = new Smartphone();

            for (int i = 0; i < numbers.Length; i++)
            {
                try
                {
                    Console.WriteLine(smartphone.Calling(numbers[i]));
                }
                catch (ArgumentException ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }

            for (int i = 0; i < urls.Length; i++)
            {
                try
                {
                    Console.WriteLine(smartphone.Browsing(urls[i]));
                }
                catch (ArgumentException ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            Smartphone      smartphone      = new Smartphone();
            StationaryPhone stationaryPhone = new StationaryPhone();

            string[] numbersInput = Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries);

            for (int i = 0; i < numbersInput.Length; i++)
            {
                if (numbersInput[i].Length == 10)
                {
                    smartphone.Calling(numbersInput[i]);
                }
                else if (numbersInput[i].Length == 7)
                {
                    stationaryPhone.Calling(numbersInput[i]);
                }
            }

            string[] siteInput = Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries);

            for (int i = 0; i < siteInput.Length; i++)
            {
                smartphone.Browsing(siteInput[i]);
            }
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            string[]   phones     = Console.ReadLine().Split();
            string[]   urls       = Console.ReadLine().Split();
            Smartphone smartphone = new Smartphone();

            foreach (var phone in phones)
            {
                try
                {
                    smartphone.CalledPhone = phone;
                    Console.WriteLine(smartphone.Calling());
                }
                catch (ArgumentException ae)
                {
                    Console.WriteLine(ae.Message);
                }
            }
            foreach (var url in urls)
            {
                try
                {
                    smartphone.Url = url;
                    Console.WriteLine(smartphone.Browsing());
                }
                catch (ArgumentException ae)
                {
                    Console.WriteLine(ae.Message);
                }
            }
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            string[] numbersToCall = Console.ReadLine().Split();
            string[] sitesToVisit  = Console.ReadLine().Split();

            foreach (var item in numbersToCall)
            {
                if (item.Length == 7)
                {
                    StationaryPhone stationaryPhone = new StationaryPhone();
                    stationaryPhone.Calling(item);
                }
                else
                {
                    Smartphone smartphone = new Smartphone();
                    smartphone.Calling(item);
                }
            }

            foreach (var item in sitesToVisit)
            {
                Smartphone smartphone = new Smartphone();
                smartphone.Browsing(item);
            }
        }
Beispiel #7
0
        static void Main()
        {
            string[] numbers = Console.ReadLine()
                               .Split(" ", StringSplitOptions.RemoveEmptyEntries);

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

            ISmartphone phone = new Smartphone(numbers, URLs);

            Console.WriteLine(phone.Calling(numbers));
            Console.WriteLine(phone.Browsing(URLs));
        }
        static void Main(string[] args)
        {
            var phoneNumbers = Console.ReadLine().Split();
            var sites        = Console.ReadLine().Split();

            foreach (var number in phoneNumbers)
            {
                if (number.Length == 7)
                {
                    try
                    {
                        ICall stationaryPhone = new StationaryPhone(number);
                        Console.WriteLine(stationaryPhone.Calling());
                    }
                    catch (ArgumentException ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }
                else if (number.Length == 10)
                {
                    try
                    {
                        ICall smartPhone = new Smartphone(number);
                        Console.WriteLine(smartPhone.Calling());
                    }
                    catch (ArgumentException ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }
            }


            foreach (var site in sites)
            {
                try
                {
                    Smartphone smartphone = new Smartphone()
                    {
                        Site = site
                    };
                    Console.WriteLine(smartphone.Browsing());
                }
                catch (ArgumentException ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }
Beispiel #9
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]);
            }
        }
        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));
            }
        }
Beispiel #11
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));
            }
        }
Beispiel #12
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!");
                }
            }
        }
Beispiel #13
0
        static void Main(string[] args)
        {
            var inputNumbers = Console.ReadLine()
                               .Split(new[] { ' ' });
            var inputSites = Console.ReadLine()
                             .Split(new[] { ' ' });
            Smartphone smartphone = new Smartphone(inputNumbers, inputSites);

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

            foreach (var site in smartphone.Sites)
            {
                Console.WriteLine(smartphone.Browsing(site));
            }
        }
Beispiel #14
0
        static void Main(string[] args)
        {
            var phoneNumbers    = Console.ReadLine().Split();
            var url             = Console.ReadLine().Split();
            var smartPhone      = new Smartphone();
            var stationaryPhone = new StationaryPhone();

            foreach (var phone in phoneNumbers)
            {
                try
                {
                    if (phone.Length == 7)
                    {
                        Console.WriteLine(stationaryPhone.Calling(phone));
                    }
                    else if (phone.Length == 10)
                    {
                        Console.WriteLine(smartPhone.Calling(phone));
                    }
                    else
                    {
                        throw new ArgumentException(Exceptions.InvalidPhoneException);
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    continue;
                }
            }
            foreach (var adress in url)
            {
                try
                {
                    Console.WriteLine(smartPhone.Browse(adress));
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    continue;
                }
            }
        }
Beispiel #15
0
        static void Main(string[] args)
        {
            string[] possiblePhoneNums = Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries);
            string[] possibleWebSites  = Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries);

            StationaryPhone stat  = new StationaryPhone();
            Smartphone      smart = new Smartphone();

            foreach (var num in possiblePhoneNums)
            {
                try
                {
                    if (num.Length == 7)
                    {
                        Console.WriteLine(stat.Calling(num));
                    }
                    else if (num.Length == 10)
                    {
                        Console.WriteLine(smart.Calling(num));
                    }
                    else
                    {
                        throw new ArgumentException(GlobalConstants.InvalidNumMsg);
                    }
                }
                catch (ArgumentException aex)
                {
                    Console.WriteLine(aex.Message);
                }
            }

            foreach (var ws in possibleWebSites)
            {
                try
                {
                    Console.WriteLine(smart.Browsing(ws));
                }
                catch (ArgumentException aex)
                {
                    Console.WriteLine(aex.Message);
                }
            }
        }
Beispiel #16
0
        public static void Main()
        {
            string[]        numbers         = Console.ReadLine().Split();
            string[]        sitesUrl        = Console.ReadLine().Split();
            StationaryPhone stationaryPhone = new StationaryPhone();
            Smartphone      smartphone      = new Smartphone();

            foreach (var number in numbers)
            {
                try
                {
                    if (number.Length == 7)
                    {
                        Console.WriteLine(stationaryPhone.Calling(number));
                    }
                    else if (number.Length == 10)
                    {
                        Console.WriteLine(smartphone.Calling(number));
                    }
                    else
                    {
                        throw new Exception("Invalid number!");
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }

            foreach (var site in sitesUrl)
            {
                try
                {
                    Console.WriteLine(smartphone.Browsing(site));
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }
Beispiel #17
0
        static void Main(string[] args)
        {
            var inputNumber = Console.ReadLine().Split();
            var inputURL    = Console.ReadLine().Split();

            foreach (var number in inputNumber)
            {
                char[] numberChar = number.ToCharArray();

                if (numberChar.Any(char.IsLetter))
                {
                    Console.WriteLine("Invalid number!");
                    continue;
                }

                if (number.Length == 10)
                {
                    Smartphone smartphone = new Smartphone();
                    smartphone.Calling(number);
                }

                if (number.Length == 7)
                {
                    StationaryPhone stationaryPhone = new StationaryPhone();
                    stationaryPhone.Dialing(number);
                }
            }

            foreach (var url in inputURL)
            {
                char[] urlChar = url.ToCharArray();

                if (urlChar.Any(char.IsDigit))
                {
                    Console.WriteLine("Invalid URL!");
                    continue;
                }

                Smartphone smartphone = new Smartphone();
                smartphone.Browsing(url);
            }
        }
Beispiel #18
0
        static void Main(string[] args)
        {
            string[] numbers = Console.ReadLine()
                               .Split(" ", StringSplitOptions.RemoveEmptyEntries);
            string[] sites = Console.ReadLine()
                             .Split(" ", StringSplitOptions.RemoveEmptyEntries);

            StationaryPhone stPhone    = new StationaryPhone();
            Smartphone      smartphone = new Smartphone();

            for (int i = 0; i < numbers.Length; i++)
            {
                try
                {
                    if (numbers[i].Length == 10)
                    {
                        Console.WriteLine(smartphone.Calling(numbers[i]));
                    }
                    else
                    {
                        Console.WriteLine(stPhone.Calling(numbers[i]));
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }

            for (int i = 0; i < sites.Length; i++)
            {
                try
                {
                    Console.WriteLine(smartphone.Browsing(sites[i]));
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }
Beispiel #19
0
        static void Main()
        {
            string[] phoneNumbers = Console.ReadLine()
                                    .Split(" ")
                                    .ToArray();
            string[] sites = Console.ReadLine()
                             .Split(" ")
                             .ToArray();

            foreach (var phoneNumber in phoneNumbers)
            {
                Smartphone smartphone = new Smartphone();

                try
                {
                    smartphone.Phone = phoneNumber;
                    Console.WriteLine(smartphone.Calling(phoneNumber));
                }
                catch (ArgumentException e)
                {
                    Console.WriteLine(e.Message);
                }
            }
            foreach (var site in sites)
            {
                Smartphone smartphone = new Smartphone();

                try
                {
                    smartphone.Site = site;
                    Console.WriteLine(smartphone.Browsing(site));
                }
                catch (ArgumentException e)
                {
                    Console.WriteLine(e.Message);
                }
            }
        }
Beispiel #20
0
        static void Main(string[] args)
        {
            string[] numbers = Console.ReadLine().Split();
            string[] urls    = Console.ReadLine().Split();

            Smartphone phone = new Smartphone();

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

                foreach (var url in urls)
                {
                    Console.WriteLine(phone.Browsing(url));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Beispiel #21
0
        static void Main(string[] args)
        {
            string[] phones = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries);
            string[] urls   = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries);

            Smartphone      smartphone      = new Smartphone();
            StationaryPhone stationaryphone = new StationaryPhone();

            foreach (string number in phones)
            {
                try
                {
                    string result = number.Length == 10
                        ? smartphone.Calling(number)
                        : stationaryphone.Calling(number);

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

            foreach (string url in urls)
            {
                try
                {
                    Console.WriteLine(smartphone.Browsing(url));
                }
                catch (InvalidOperationException exeption)
                {
                    Console.WriteLine(exeption.Message);
                }
            }
        }