public decimal Calculate(string text) { var query = _queryParser.Parse(text); var result = 0m; switch (query.Operation) { case "x": result = _multiplier.Multiply(query.FirstNumber, query.SecondNumber); break; case "+": result = _adder.Add(query.FirstNumber, query.SecondNumber); break; case "-": result = _subtractor.Subtract(query.FirstNumber, query.SecondNumber); break; case "/": result = _divider.Divide(query.FirstNumber, query.SecondNumber); break; } return(result); }
public void DoMath() { switch (selectOperator) { case "+": Console.WriteLine(adder.Add()); break; case "-": Console.WriteLine(subtractor.Subtract( )); break; case "*": Console.WriteLine(multiplier.Multiply()); break; case "/": Console.WriteLine(divider.Divide()); break; case "^": Console.WriteLine(exponenter.Exponent()); break; default: break; } }
public TValue Update(TKey key, TValue value) { _deltas[key] = _subtractor.Subtract(value, _values[key]); _values[key] = value; return(_deltas[key]); }
public T Subtract(T valueX, T valueY) { return(_subtractor.Subtract(valueX, valueY)); }
public int Subtract(int a, int b) => _subtractor.Subtract(a, b);
public void Update(T value) { _delta = _subtractor.Subtract(value, _value); _value = value; }
public void Handle(int firstNum, int secondNum) { adder.Add(firstNum, secondNum); subtractor.Subtract(firstNum, secondNum); }