static void Main(string[] args) { ISmartphone smartphone = new Smartphone(); smartphone.Calling(); smartphone.Browsing(); }
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); } }
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)); } }
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); } } }
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]); } }
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)); } }
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); } } }
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[] 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); } } }
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)); } }
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)); } }
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)); } }
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!"); } } }
static void Main(string[] args) { var smartphone = new Smartphone(); var numbers = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries); foreach (var number in numbers) { Console.WriteLine(smartphone.MakeCall(number)); } var sites = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries); foreach (var site in sites) { Console.WriteLine(smartphone.Browsing(site)); } }
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)); } }
public static void Main() { var phoneNumbers = Console.ReadLine().Split(' ').ToList(); var sites = Console.ReadLine().Split(' ').ToList(); var smartphone = new Smartphone(); var stationaryPhone = new StationaryPhone(); for (int i = 0; i < phoneNumbers.Count; i++) { try { if (phoneNumbers[i].ToString().Length == 7) { stationaryPhone.Phone = phoneNumbers[i]; Console.WriteLine(stationaryPhone.Deal()); } else { smartphone.Phone = phoneNumbers[i]; Console.WriteLine(smartphone.Call()); } } catch (Exception ex) { Console.WriteLine(ex.Message); } } for (int i = 0; i < sites.Count; i++) { try { smartphone.Site = sites[i]; Console.WriteLine(smartphone.Browsing()); } catch (Exception ex) { Console.WriteLine(ex.Message); } } }
static void Main(string[] args) { string[] numbers = Console.ReadLine().Split(); Smartphone smartphone = new Smartphone(); foreach (var number in numbers) { try { smartphone.CallingOtherPhones(number); } catch (Exception ex) { Console.WriteLine(ex.Message); } } string[] URLs = Console.ReadLine().Split(); foreach (var url in URLs) { try { smartphone.Browsing(url); } catch (Exception ex) { Console.WriteLine(ex.Message); } } //catch (Exception ex) //{ // Console.WriteLine(ex.Message); //} }
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); } } }
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); } } }
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); } }
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); } } }
static void Main(string[] args) { var phoneNumbers = Console.ReadLine().Split().ToArray(); var url = Console.ReadLine().Split().ToArray(); foreach (var number in phoneNumbers) { if (!number.All(char.IsDigit)) { Console.WriteLine("Invalid number!"); continue; } IPhone phone = null; if (number.Length == 10) { phone = new Smartphone(); } if (number.Length == 7) { phone = new StationaryPhone(); } phone.Calling(number); } foreach (var address in url) { if (address.Any(char.IsDigit)) { Console.WriteLine("Invalid URL!"); continue; } IBrows phone = new Smartphone(); phone.Browsing(address); } }
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); } } }
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); } }
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); } } }