Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            var numbers = Console.ReadLine()
                          .Split(' ', StringSplitOptions.RemoveEmptyEntries);

            var sites = Console.ReadLine()
                        .Split(' ', StringSplitOptions.RemoveEmptyEntries);

            var smartphone      = new Smartphone();
            var stationaryPhone = new StationaryPhone();

            foreach (var number in numbers)
            {
                if (number.Length == 7)
                {
                    stationaryPhone.Call(number);
                }
                else
                {
                    smartphone.Call(number);
                }
            }

            foreach (var site in sites)
            {
                smartphone.Browse(site);
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            SmartPhone      smartPhone      = new SmartPhone();
            StationaryPhone stationaryPhone = new StationaryPhone();

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

            foreach (var phoneNumber in phoneNumbers)
            {
                if (phoneNumber.Length == 10)
                {
                    smartPhone.Call(phoneNumber);
                }
                else
                {
                    stationaryPhone.Call(phoneNumber);
                }
            }

            foreach (var site in sites)
            {
                smartPhone.Browse(site);
            }
        }
Ejemplo n.º 3
0
        public static void Main(string[] args)
        {
            string[] phoneNumbers = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries).ToArray();
            string[] websites     = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries).ToArray();

            foreach (var number in phoneNumbers)
            {
                if (number.Length == 7)
                {
                    StationaryPhone sp = new StationaryPhone();

                    Console.WriteLine(sp.Call(number));
                }
                else if (number.Length == 10)
                {
                    Smartphone smartPhone = new Smartphone();

                    Console.WriteLine(smartPhone.Call(number));
                }
                else
                {
                    Console.WriteLine("Invalid number!");
                }
            }

            foreach (var site in websites)
            {
                Smartphone smartPhone = new Smartphone();

                Console.WriteLine(smartPhone.Browse(site));
            }
        }
        public static void Main()
        {
            var phonenumbers    = Console.ReadLine().Split(" ");
            var smartphone      = new Smartphone();
            var stationaryphone = new StationaryPhone();

            for (int i = 0; i < phonenumbers.Length; i++)
            {
                var phonenumber = phonenumbers[i];
                if (phonenumber.Length == 7)
                {
                    Console.WriteLine(stationaryphone.Colling(phonenumber));
                }
                else if (phonenumber.Length == 10)
                {
                    Console.WriteLine(smartphone.Colling(phonenumber));
                }
            }
            var sitestobrowse = Console.ReadLine().Split(" ");

            for (int i = 0; i < sitestobrowse.Length; i++)
            {
                var site = sitestobrowse[i].ToString();
                Console.WriteLine(smartphone.Browsing(site));
            }
        }
Ejemplo n.º 5
0
        static void Main()
        {
            string[] numbers   = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries).ToArray();
            string[] addresses = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries).ToArray();

            foreach (string number in numbers)
            {
                if (number.Length == 10)
                {
                    Smartphone newPhone = new Smartphone();
                    newPhone.Number = number;
                    Console.WriteLine(newPhone.CallNumber());
                }
                else
                {
                    StationaryPhone newPhone = new StationaryPhone(number);
                    newPhone.Number = number;
                    Console.WriteLine(newPhone.CallNumber());
                }
            }

            foreach (string address in addresses)
            {
                Smartphone newPhone = new Smartphone();
                newPhone.Address = address;
                Console.WriteLine(newPhone.BrowseAddress());
            }
        }
Ejemplo n.º 6
0
        public static void Main(string[] args)
        {
            Smartphone      smartphone      = new Smartphone();
            StationaryPhone stationaryPhone = new StationaryPhone();
            IBrowsable      browsable       = new Smartphone();

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

            foreach (var nums in numbers)
            {
                if (nums.Length >= 10)
                {
                    Console.WriteLine(smartphone.Call(nums));
                }
                else if (nums.Length <= 7)
                {
                    Console.WriteLine(stationaryPhone.Call(nums));
                }
            }

            foreach (var web in website)
            {
                Console.WriteLine(browsable.Browse(web));
            }
        }
Ejemplo n.º 7
0
        static void Main(string[] args)
        {
            Smartphone      huawei    = new Smartphone();
            StationaryPhone panasonic = new StationaryPhone();

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

            foreach (var number in numbers)
            {
                if (number.Length == 7)
                {
                    panasonic.Call(number);
                }
                else if (number.Length == 10)
                {
                    huawei.Call(number);
                }
            }

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

            foreach (var url in urls)
            {
                huawei.Browse(url);
            }
        }
Ejemplo n.º 8
0
        static void Main(string[] args)
        {
            Smartphone      smartphone      = new Smartphone();
            StationaryPhone stationaryPhone = new StationaryPhone();

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

            foreach (string telephonNumber in telephonNumbers)
            {
                if (telephonNumber.Length == 7)
                {
                    Console.WriteLine(stationaryPhone.Call(telephonNumber));
                }
                else if (telephonNumber.Length == 10)
                {
                    Console.WriteLine(smartphone.Call(telephonNumber));
                }
                else
                {
                    Console.WriteLine("Invalid number!");
                }
            }
            foreach (string url in urls)
            {
                Console.WriteLine(smartphone.Browse(url));
            }
        }
Ejemplo n.º 9
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));
            }
        }
Ejemplo n.º 10
0
        static void Main(string[] args)
        {
            Smartphone      nokia = new Smartphone();
            StationaryPhone phone = new StationaryPhone();

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

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

                if (number.Length == 7)
                {
                    phone.Call(number);
                }
                else if (number.Length == 10)
                {
                    nokia.Call(number);
                }
            }

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

            for (int i = 0; i < secondInput.Length; i++)
            {
                nokia.Browse(secondInput[i]);
            }
        }
Ejemplo n.º 11
0
        public static void Main(string[] args)
        {
            var phoneNumbers = Console.ReadLine().Split().ToList();
            var webSites     = Console.ReadLine().Split().ToList();
            var phone        = new Smartphone();
            var statPhone    = new StationaryPhone();

            foreach (var number in phoneNumbers)
            {
                if (number.Length == 10)
                {
                    Console.WriteLine(phone.Call(number));
                }
                else if (number.Length == 7)
                {
                    Console.WriteLine(statPhone.Call(number));
                }
                else
                {
                    Console.WriteLine("Invalid number!");
                }
            }

            foreach (var webSite in webSites)
            {
                Console.WriteLine(phone.Browse(webSite));
            }
        }
Ejemplo n.º 12
0
        static void Main(string[] args)
        {
            var numbers         = Console.ReadLine().Split(" ").ToArray();
            var websites        = Console.ReadLine().Split(" ").ToArray();
            var smartPhone      = new Smartphone();
            var stationaryPhone = new StationaryPhone();

            foreach (var number in numbers)
            {
                if (number.Length == 10)
                {
                    Console.WriteLine(smartPhone.Call(number));
                }
                else if (number.Length == 7)
                {
                    Console.WriteLine(stationaryPhone.Call(number));
                }
                else
                {
                    Console.WriteLine("Invalid number!");
                }
            }
            foreach (var site in websites)
            {
                Console.WriteLine(smartPhone.Browse(site));
            }
        }
Ejemplo n.º 13
0
        static void Main(string[] args)
        {
            string[] phoneNumbers = Console.ReadLine().Split(" ");

            for (int i = 0; i < phoneNumbers.Length; i++)
            {
                if (phoneNumbers[i].Length == 7)
                {
                    ICall caller = new StationaryPhone();
                    caller.Call(phoneNumbers[i]);
                }

                else
                {
                    ICall caller = new Smartphone();
                    caller.Call(phoneNumbers[i]);
                }
            }

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

            for (int i = 0; i < browsers.Length; i++)
            {
                IBrowse browse = new Smartphone();
                browse.Browse(browsers[i]);
            }
        }
        static void Main(string[] args)
        {
            string[] phones = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries);
            string[] webs   = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries);


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

            for (int i = 0; i < phones.Length; i++)
            {
                if (phones[i].Length == 7)
                {
                    Console.WriteLine(stationaryPhone.Call(phones[i]));
                }
                else
                {
                    Console.WriteLine(smartphone.Call(phones[i]));
                }
            }

            for (int j = 0; j < webs.Length; j++)
            {
                Console.WriteLine(smartphone.Brawsing(webs[j]));
            }
        }
Ejemplo n.º 15
0
        public static void Main()
        {
            List <string> numbers = Console.ReadLine()
                                    .Split(' ', StringSplitOptions.RemoveEmptyEntries)
                                    .ToList();

            List <string> urls = Console.ReadLine()
                                 .Split(' ', StringSplitOptions.RemoveEmptyEntries)
                                 .ToList();

            var stationaryPhone = new StationaryPhone("Dialing... ");
            var smartPhone      = new SmartPhone("Calling... ");

            foreach (var number in numbers)
            {
                if (number.Length == 7)
                {
                    stationaryPhone.Call(number);
                }
                else if (number.Length == 10)
                {
                    smartPhone.Call(number);
                }
                else
                {
                    Console.WriteLine("Invalid number!");
                }
            }

            foreach (var url in urls)
            {
                smartPhone.Browse(url);
            }
        }
Ejemplo n.º 16
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);
            }
        }
Ejemplo n.º 17
0
        static void Main(string[] args)
        {
            string[] callNumbers = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries);
            string[] webUrls     = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries);

            Smartphone      smartP   = new Smartphone();
            StationaryPhone stationP = new StationaryPhone();

            for (int i = 0; i < callNumbers.Length; i++)
            {
                if (callNumbers[i].Length == 10)
                {
                    Console.WriteLine(smartP.Call(callNumbers[i]));
                }
                if (callNumbers[i].Length == 7)
                {
                    Console.WriteLine(stationP.Call(callNumbers[i]));
                }
                if (callNumbers[i].Length != 7 && callNumbers[i].Length != 10)
                {
                    Console.WriteLine("Invalid number!");
                }
            }

            for (int i = 0; i < webUrls.Length; i++)
            {
                Console.WriteLine(smartP.Browse(webUrls[i]));
            }
        }
Ejemplo n.º 18
0
        public static void Main()
        {
            IBrowseable smartphone      = new Smartphone();
            ICallable   stationaryPhone = new StationaryPhone();

            string[] inputNumbers = Console.ReadLine()
                                    .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                                    .ToArray();

            string[] inputSites = Console.ReadLine()
                                  .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                                  .ToArray();

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

                if (number.Length == 10)
                {
                    Console.WriteLine(smartphone.Call(inputNumbers[i]));
                }
                else
                {
                    Console.WriteLine(stationaryPhone.Call(inputNumbers[i]));
                }
            }

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

                Console.WriteLine(smartphone.Browse(site));
            }
        }
Ejemplo n.º 19
0
        static void Main(string[] args)
        {
            string[] numbers = Console.ReadLine()
                               .Split();
            string[] url = Console.ReadLine()
                           .Split();
            ICall calling = null;

            foreach (var item in numbers)
            {
                if (item.Length == 10)
                {
                    calling = new Smartphone();
                    calling.Call(item);
                }
                else
                {
                    calling = new StationaryPhone();
                    calling.Call(item);
                }
            }
            foreach (var item in url)
            {
                IBrowse browse = new Smartphone();
                browse.Browse(item);
            }
        }
Ejemplo n.º 20
0
        static void Main(string[] args)
        {
            List <string> phoneNumbers = Console.ReadLine()
                                         .Split(' ', StringSplitOptions.RemoveEmptyEntries)
                                         .ToList();

            List <string> websites = Console.ReadLine()
                                     .Split(' ', StringSplitOptions.RemoveEmptyEntries)
                                     .ToList();

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

            foreach (string n in phoneNumbers)
            {
                if (n.Length == 10)
                {
                    Console.WriteLine(smartphone.Dial(n));
                }
                else
                {
                    Console.WriteLine(stationary.Dial(n));
                }
            }

            foreach (string site in websites)
            {
                Console.WriteLine(smartphone.Browse(site));
            }
        }
Ejemplo n.º 21
0
        static void Main(string[] args)
        {
            var phones = Console.ReadLine().Split().ToList();

            var smartPhone      = new Smartphone();
            var stationaryPhone = new StationaryPhone();

            foreach (var number in phones)
            {
                if (number.Length == 7)
                {
                    Console.WriteLine(stationaryPhone.CallOtherPhone(number));
                }
                else
                {
                    Console.WriteLine(smartPhone.CallOtherPhone(number));
                }
            }

            var websites = Console.ReadLine().Split().ToList();

            foreach (var site in websites)
            {
                Console.WriteLine(smartPhone.SurfTheWeb(site));
            }
        }
Ejemplo n.º 22
0
        public static void Main(string[] args)
        {
            string[] numbers = Console.ReadLine().Split();
            string[] urls    = Console.ReadLine().Split();

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

            for (int i = 0; i < numbers.Length; i++)
            {
                if (numbers[i].Length == 7)
                {
                    Console.WriteLine(stationaryPhone.Call(numbers[i]));
                }

                else if (numbers[i].Length == 10)
                {
                    Console.WriteLine(smartphone.Call(numbers[i]));
                }
            }

            for (int i = 0; i < urls.Length; i++)
            {
                Console.WriteLine(smartphone.Browse(urls[i]));
            }
        }
Ejemplo n.º 23
0
        static void Main(string[] args)
        {
            string[] numbers = Console.ReadLine().Split();
            string[] urls    = Console.ReadLine().Split();

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

            foreach (var item in numbers)
            {
                try
                {
                    string result = item.Length == 10 ? smartphone.Call(item) : stationaryPhone.Call(item);
                    Console.WriteLine(result);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
            foreach (var url in urls)
            {
                try
                {
                    string result = smartphone.Browse(url);
                    Console.WriteLine(result);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }
Ejemplo n.º 24
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]);
            }
        }
Ejemplo n.º 25
0
        static void Main(string[] args)
        {
            var firstLine  = Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries);
            var secondLine = Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries);

            var  smartPhone      = new Smartphone();
            var  stationaryPhone = new StationaryPhone();
            bool flag            = false;

            foreach (var number in firstLine)
            {
                flag = false;
                foreach (var digit in number)
                {
                    if (!char.IsDigit(digit))
                    {
                        flag = true;
                    }
                }

                if (flag == true)
                {
                    Console.WriteLine("Invalid number!");
                    continue;
                }
                else if (number.Length == 10)
                {
                    Console.WriteLine(smartPhone.Call(number));
                }
                else
                {
                    Console.WriteLine(stationaryPhone.Call(number));
                }
            }

            foreach (var URL in secondLine)
            {
                flag = false;
                foreach (var digit in URL)
                {
                    if (char.IsDigit(digit))
                    {
                        flag = true;
                    }
                }

                if (flag == true)
                {
                    Console.WriteLine("Invalid URL!");
                    continue;
                }
                else
                {
                    Console.WriteLine(smartPhone.Browse(URL));
                }
            }
        }
Ejemplo n.º 26
0
        public static void Main(string[] args)
        {
            Smartphone      smartphone      = new Smartphone();
            StationaryPhone stationaryPhone = new StationaryPhone();

            //List<string> smartphones = new List<string>();
            //List<string> stationaryPhones = new List<string>();

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

            bool isNotOK    = false;
            bool isNotBrows = false;

            for (int i = 0; i < numbers.Length; i++)
            {
                for (int y = 0; y < numbers[i].Length; y++)
                {
                    if (!char.IsDigit(numbers[i][y]) || numbers[i].Length != 10 && numbers[i].Length != 7)
                    {
                        Console.WriteLine("Invalid number!");
                        isNotOK = true;
                        break;
                    }
                }

                if (numbers[i].Length == 10 && isNotOK == false)
                {
                    Console.WriteLine(smartphone.Call(numbers[i]));
                }
                else if (numbers[i].Length == 7 && isNotOK == false)
                {
                    Console.WriteLine(stationaryPhone.Call(numbers[i]));
                }

                isNotOK = false;
            }

            for (int i = 0; i < sites.Length; i++)
            {
                for (int y = 0; y < sites[i].Length; y++)
                {
                    if (char.IsDigit(sites[i][y]))
                    {
                        Console.WriteLine("Invalid URL!");
                        isNotBrows = true;
                        break;
                    }
                }
                if (isNotBrows == false)
                {
                    Console.WriteLine(smartphone.Browsing(sites[i]));
                }

                isNotBrows = false;
            }
        }
        static void Main(string[] args)
        {
            Queue <string> numbers = new Queue <string>
                                         (Console.ReadLine().Split());
            Queue <string> webSites = new Queue <string>
                                          (Console.ReadLine().Split());
            Smartphone      smartphone      = new Smartphone();
            StationaryPhone stationaryPhone = new StationaryPhone();

            Dialling(numbers, smartphone, stationaryPhone);
            Browsing(webSites, smartphone);
        }
Ejemplo n.º 28
0
        static void Main(string[] args)
        {
            string[] numbers = Console.ReadLine()
                               .Split(" ", StringSplitOptions.RemoveEmptyEntries)
                               .ToArray();


            for (int i = 0; i < numbers.Length; i++)
            {
                try
                {
                    if (numbers[i].Length == 7)
                    {
                        StationaryPhone StatPhone = new StationaryPhone(numbers[i]);
                        StatPhone.Call();
                    }
                    else if (numbers[i].Length == 10)
                    {
                        Smartphone currSmarPhone = new Smartphone();
                        currSmarPhone.Number = numbers[i];
                        currSmarPhone.Call();
                    }
                    else
                    {
                        Console.WriteLine($"Invalid number!");
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }

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

            for (int i = 0; i < Urls.Length; i++)
            {
                try
                {
                    Smartphone currSmartPhone = new Smartphone();
                    currSmartPhone.Url = Urls[i];
                    currSmartPhone.Browse();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
        }
Ejemplo n.º 29
0
        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);
                }
            }
        }
Ejemplo n.º 30
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);
        }