public string calc(string s) { Calculator calculator = new Calculator(); Num answer = calculator.calculate(s); if (answer == null) return "Sorry. The order is valid. Please check your order."; return answer.toString(); }
public void generateCorrectList(string questionFile) { Calculator calc = new Calculator(); StreamReader readerQ = new StreamReader(questionFile); string line = readerQ.ReadLine(); while (line != null) { int p = line.IndexOf(" "); string ques = line.Substring(p + 1); Num re = calc.calculate(ques); correctList.Add(re.toString()); line = readerQ.ReadLine(); } readerQ.Close(); }