static void Main(string[] args)
        {
            string[] numbers = ReadConsole();
            string[] url     = ReadConsole();
            ICall    calling = null;

            foreach (var item in numbers)
            {
                if (item.Length == 10)
                {
                    calling = new Smartphone();
                    calling.Calling(item);
                }
                else
                {
                    calling = new StationaryPhone();
                    calling.Calling(item);
                }
            }
            foreach (var item in url)
            {
                IBrowse browse = new Smartphone();
                browse.Browsing(item);
            }
        }
Example #2
0
        public Engine(IReader reader, IWriter writer)
        {
            this.reader = reader;
            this.writer = writer;

            this.smartphone      = new Smartphone();
            this.stationaryPhone = new StationaryPhone();
        }
Example #3
0
        public void Proceed()
        {
            var phoneNumbersToCall = Reading();

            var websitesToVisit = Reading();

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

            PrintPhoneNumbers(phoneNumbersToCall, smartphone, stationaryPhone);
            PrintWebsiteURLs(websitesToVisit, smartphone);
        }
Example #4
0
        static void Main(string[] args)
        {
            string[] numbers = Console.ReadLine()
                               .Split()
                               .ToArray();
            string[]         urls            = Console.ReadLine().Split(" ", StringSplitOptions.RemoveEmptyEntries);
            ISmartphone      smartphone      = new Smartphone();
            IStationaryPhone stationaryPhone = new StationaryPhone();

            foreach (string number in numbers)
            {
                bool isWrong = false;
                foreach (var item in number)
                {
                    if (!char.IsDigit(item))
                    {
                        isWrong = true;
                        Console.WriteLine("Invalid number!");
                        break;
                    }
                }
                if (!isWrong)
                {
                    if (number.Length == 10)
                    {
                        Console.WriteLine(smartphone.Calling(number));
                    }
                    else if (number.Length == 7)
                    {
                        Console.WriteLine(stationaryPhone.Calling(number));
                    }
                }
            }
            foreach (var CurrURL in urls)
            {
                bool isFake = false;
                foreach (char CurrerntSite in CurrURL)
                {
                    if (char.IsDigit(CurrerntSite))
                    {
                        Console.WriteLine($"Invalid URL!");
                        isFake = true;
                        break;
                    }
                }
                if (!isFake)
                {
                    Console.WriteLine(smartphone.Browse(CurrURL));
                }
            }
        }
 private Engine()
 {
     this.stationaryPhone = new StationaryPhone();
     this.smartphone      = new Smartphone();
 }
Example #6
0
        private static void PrintPhoneNumbers(List <string> phoneNumbersToCall, Smartphone smartphone, StationaryPhone stationaryPhone)
        {
            foreach (var item in phoneNumbersToCall)
            {
                if (!item.All(x => char.IsDigit(x)))
                {
                    Console.WriteLine("Invalid number!");
                    continue;
                }

                if (item.Length == 7)
                {
                    stationaryPhone.Call(item);
                }
                else
                {
                    smartphone.Call(item);
                }
            }
        }
Example #7
0
 private Engine()
 {
     smartphone   = new Smartphone();
     stationPhone = new StationaryPhone();
 }
Example #8
0
 public Engine()
 {
     smartPhone      = new Smartphone();
     stationaryPhone = new StationaryPhone();
 }
Example #9
0
 public Engine()
 {
     this.stationaryPhone = new StationaryPhone();
     this.smartphone      = new Smartphone();
 }