public void Input(string s) { if (s.Equals("C")) { Clear(); } else if (s.Equals("=")) { CompleteCalculation(); currentValue = null; } else { if (Operator.StringIsOperator(s)) { currentValue = null; PushOperator(new Operator(s)); } else { ApplyToCurrentValue(s); } } NotifyDisplayChanged(); }
public void Input(string s) { if (s.Equals("C")) { Clear(); } else if (s.Equals("=")) { CompleteCalculation(); currentValue = null; } else { if (Operator.StringIsOperator(s)) { currentValue = null; PushOperator(new Operator(s)); } else { ApplyToCurrentValue(s); } } var latestValue = (valueStack.Count == 0) ? "0" : valueStack.Peek().ToString(); Display = latestValue; }