Пример #1
0
        public void testcalculateArea()
        {
            var math   = new AdvMath();
            var result = math.calculateArea(3, 7);

            Assert.True(result == 21);
        }
Пример #2
0
        static void Main()
        {
            string[] args = Environment.GetCommandLineArgs();

            /*  foreach(var a in args)
             * {
             *    Console.WriteLine(a);
             * }
             *
             * Console.ReadLine(); */

            AreArgumentsValid(args);

            var Math    = new BasicMath();
            var advMath = new AdvMath();


            switch (_operand.ToString())
            {
            case "add":
                Console.WriteLine($"{_num1} + {_num2} = {Math.addNumbers(_num1, _num2)}");
                break;

            case "sub":
                Console.WriteLine($"{_num1} - {_num2} = {Math.subtractNumbers(_num1, _num2)}");
                break;

            case "mult":
                Console.WriteLine($"{_num1} * {_num2} = {Math.multiplyNumbers(_num1, _num2)}");
                break;

            case "div":
                Console.WriteLine($"{_num1} / {_num2} = {Math.divideNumbers(_num1, _num2)}");
                break;

            case "area":
                Console.WriteLine($"{_num1} * {_num2} H = {advMath.calculateArea(_num1, _num2)}.");
                break;

            case "avg":
                Console.WriteLine($"{_num1}, {_num2}, {_num3}, {_num4} = {advMath.calculateListAverage(_num1, _num2, _num3, _num4)}");
                break;

            case "squared":
                Console.WriteLine($"{_num1}^2 = {advMath.calculateValueSquared(_num1)}");
                break;

            case "pyth":
                Console.WriteLine($"{_num1}^2 + {_num2}^2 = {advMath.calculatePythagoreanTheorem(_num1, _num2)}");
                break;

            default:
                Console.WriteLine($"{_operand} is not a valid operator. Please enter Add, Sub, Mul, Div, area, avg, squared, pyth");
                break;
            }

            Console.ReadLine();
        }