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); } }
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) { 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 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; } } }
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) { 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); } } }
public static void Main(string[] args) { string[] firstLine = Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries); string[] secondLine = Console.ReadLine().Split(' ', StringSplitOptions.RemoveEmptyEntries); SmarthPhone smarthPhone = new SmarthPhone(); StationaryPhone stationaryPhone = new StationaryPhone(); foreach (var number in firstLine) { try { string result = number.Length == 10 ? smarthPhone.Calling(number) : stationaryPhone.Calling(number); Console.WriteLine(result); } catch (InvalidOperationException ex) { Console.WriteLine(ex.Message); } } foreach (var url in secondLine) { try { Console.WriteLine(smarthPhone.Browsing(url)); } catch (InvalidOperationException 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); } } }