Пример #1
0
        public void Diviioneightnineis()
        {
            //Act
            double result = sut.Division(9, 0.5);

            //assert
            Assert.AreEqual(18, result);
        }
Пример #2
0
        static void Main(string[] args)
        {
            char cont = '+';

            while (cont == '+')
            {
                double num1, num2, result;
                char   oper;
                Console.WriteLine("Enter First number");
                num1 = Convert.ToDouble(Console.ReadLine());

                Console.WriteLine("Enter operation +-*/");
                oper = Convert.ToChar(Console.ReadLine());

                Console.WriteLine("Enter Second number");
                num2 = Convert.ToDouble(Console.ReadLine());
                CalculatorOp CalculatorOp = new CalculatorOp();
                if (oper == '+')
                {
                    result = CalculatorOp.Add(num1, num2);
                    Console.WriteLine(num1 + " + " + num2 + " = " + result);
                }
                else if (oper == '-')
                {
                    result = CalculatorOp.Substract(num1, num2);
                    Console.WriteLine(num1 + " - " + num2 + " = " + result);
                }
                else if (oper == '*')
                {
                    result = CalculatorOp.Mult(num1, num2);
                    Console.WriteLine(num1 + " * " + num2 + " = " + result);
                }
                else if (oper == '/')
                {
                    result = CalculatorOp.Division(num1, num2);
                    Console.WriteLine(num1 + " / " + num2 + " = " + result);
                }
                else
                {
                    Console.WriteLine("Unknown operator");
                }
                Console.WriteLine("Continue? +/-");
                cont = Convert.ToChar(Console.ReadLine());
            }
        }