private void BtnDevide_Click(object sender, EventArgs e) { if (ValidateInputs()) { int devide = mycalc.Divide((int)txtNumber1.Value, (int)txtNumber2.Value); MessageBox.Show("حاصل تقسیم = " + devide); } }
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); } }
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)); }
public void DivideTest() { _calculate = new Calculate(); Assert.AreEqual(expected: _calculate.Divide(49, 7), 7); }