Пример #1
0
 private void BtnDevide_Click(object sender, EventArgs e)
 {
     if (ValidateInputs())
     {
         int devide = mycalc.Divide((int)txtNumber1.Value, (int)txtNumber2.Value);
         MessageBox.Show("حاصل تقسیم = " + devide);
     }
 }
Пример #2
0
        public static double basicOp(char operation, double value1, double value2)
        {
            _calculate = new Calculate();

            switch (operation)
            {
            case '+':
                return(_calculate.Add(value1, value2));

            case '-':
                return(_calculate.Subtract(value1, value2));

            case '*':
                return(_calculate.Multiply(value1, value2));

            case '/':
                return(_calculate.Divide(value1, value2));

            default:
                return(-1);
            }
        }
Пример #3
0
 public IActionResult Index(CalculatorViewModel model, string command)
 {
     if (command == "add")
     {
         _modelService.Addition(model);
     }
     if (command == "sub")
     {
         _modelService.Sububstract(model);
     }
     if (command == "mul")
     {
         _modelService.Multiply(model);
     }
     if (command == "div")
     {
         _modelService.Divide(model);
     }
     if (command == "mod")
     {
         _modelService.Modulo(model);
     }
     return(View(model));
 }
Пример #4
0
 public void DivideTest()
 {
     _calculate = new Calculate();
     Assert.AreEqual(expected: _calculate.Divide(49, 7), 7);
 }