Example #1
0
        /// <summary>
        /// Main method of this program.
        /// </summary>
        /// <param name="args">Arguments passed to the program.</param>
        public static void Main(string[] args)
        {
            try
            {
                Console.WriteLine("HackerRank.");
                IChallenge challenge = DomainChooser();
                Console.WriteLine(challenge.Instructions());
                challenge.Input();
                Console.WriteLine(challenge.Output());

                Console.WriteLine("Press any key to exit...");
                Console.ReadKey();
            }
            catch (ChallengeException e)
            {
                Console.WriteLine("Please choose a valid challenge.\n" +
                                  "See valid challenge in https://www.hackerrank.com/domains");
                Console.Error.WriteLine(e.Message);
            }
            catch (DomainException e)
            {
                Console.WriteLine("Please choose a valid domains.\n" +
                                  "See valid challenge in https://www.hackerrank.com/domains");
                Console.Error.WriteLine(e.Message);
            }
            catch (FormatException e)
            {
                Console.WriteLine("Please enter a valid number.");
                Console.Error.WriteLine(e.Message);
            }
        }