Example #1
0
        static void Main(string[] args)
        {
            ConsoleMenu consoleMenu = new ConsoleMenu();
            HomeWorkHelper homeWorkHelper = new HomeWorkHelper();

            try
            {
                //homeWorkHelper.PrintHelloWorld();
                //homeWorkHelper.Average();
                //homeWorkHelper.ReturnNumberOfDigits();
                //homeWorkHelper.WriteNumberRange();
                //homeWorkHelper.IsNumberNegative();
                //homeWorkHelper.PlaySound();
                //homeWorkHelper.FlipAbsForNumber();
                //homeWorkHelper.ReturnAbsForNumber();
                //-homeWorkHelper.IsNumberCanBeDividedByNumber(3, 1);
                //homeWorkHelper.ReturnRandomNumberForRange();
                //homeWorkHelper.ShowDivisionResult();
                //-homeWorkHelper.ReturnModuloForNumbers(5, 4);
            }
            catch (Exception ignored)
            {
                Console.WriteLine("General exception occured!\nCause: {0}", ignored.Message);
            }

            ConsoleGraphicsUtils.DrawColoredText("\nPress any key to quit...", ConsoleColor.Red);
            Console.ReadKey();
        }
        public ConsoleMenu()
        {
            hwHelper = new HomeWorkHelper();

            positionsMenu.Add("1) Print 'Hello, World!' number of times.", "PrintHelloWorld");
            positionsMenu.Add("2) Average for two numbers.", "Average");
            positionsMenu.Add("3) Number of digits.", "ReturnNumberOfDigits");
            positionsMenu.Add("4) Print numbers for range.", "WriteNumberRange");
            positionsMenu.Add("5) Determination of a number negativity.", "IsNumberNegative");
            positionsMenu.Add("6) Beep sound number of times.", "PlaySound");
            positionsMenu.Add("7) Flip sign for number.", "FlipAbsForNumber");
            positionsMenu.Add("8) Module of number.", "ReturnAbsForNumber");
            positionsMenu.Add("9) Check number by number division.", "IsNumberCanBeDividedByNumber");
            positionsMenu.Add("10) Print random number from range.", "ReturnRandomNumberForRange");
            positionsMenu.Add("11) Division result.", "ShowDivisionResult");
            positionsMenu.Add("12) Division remainder.", "ReturnModuloForNumbers");
            positionsMenu.Add("Exit", "Exit");

            InitAndRunMainMenu();
        }