private static void AddNumberToQueue(string number) { if (!CheckForFails.isEmpty(number)) { result.Enqueue(CreateCalcObject("Number", number)); } }
public void Calculate() { string response; Calculator calculator = new Calculator(); SpecialCommand specialCommand = new SpecialCommand(); PrintHelpInformation(); while (true) { ScanExpression(); response = specialCommand.GetResponse(expression); if (response == "exit") { break; } else if (expression != response) { PrintResponse(response); } else { response = CheckForFails.GetResponse(expression); if (expression != response) { PrintResponse(response); } else { PrintResult(calculator.Calculate(expression)); } } } ExitMessage(); }
private static bool IsDigit(char previous, char current, int i) { if (Char.IsDigit(current) || current == ',' || (current == '-' && (i == 0 || (i > 0 && (previous == '(' || CheckForFails.isEmpty(previous.ToString())))))) { return(true); } else { return(false); } }