Example #1
0
        private static void MainMenu()
        {
            var    work = true;
            int    choice;
            int    item;
            String again;

            while (work)
            {
                Out.Line("Take a choise:\n1 - Throw a coin\n2 - Check number for perfection\n3 - Reverse your number\n4 - Numbers operations\n5 - Exit\n->");
                try {
                    choice = Read.Integer();
                } catch (Exception e) {
                    Out.NewLine("Type error. Please, input integer.");
                    continue;
                }
                switch (choice)
                {
                case 1:
                    Out.Line("Input a limit for throwing: ");
                    item = integerChecker();
                    var head = HeadsOrTails.GetHeadResult(item);
                    Out.NewLine("Heads: " + head);
                    Out.NewLine("Tails: " + (item - head));
                    break;

                case 2:
                    Out.Line("Input a number for check: ");
                    item = integerChecker();
                    Out.NewLine("Result: " + PerfectOrNo.CheckerForPerfection(item));
                    break;

                case 3:
                    Out.Line("Input any number: ");
                    item = integerChecker();
                    Out.NewLine("Your reversed value: " + Reversed.Reverser(item));
                    break;

                case 4:
                    FourthMenu();
                    break;

                default:
                    work = false;
                    break;
                }
            }            //cycle
        }
Example #2
0
        public void PerfectionTest()
        {
            int perfect = 496;

            Assert.AreEqual(true, PerfectOrNo.CheckerForPerfection(perfect));
        }