|
1 | 1 | /*
|
2 |
| -Given an expression string, return the final result of this expression. The expression contains only integer, +, -, *, /, (, ). |
3 |
| -Example: For the expression "2*6-(23+7)/(1+2)", return 2 |
| 2 | +Given an expression string, return the final result of this expression. The expression contains only integer,spaces,+, -, *, /, (, ). |
| 3 | +Example: For the expression "2 * 6 -(23 + 7) / (1 +2)", return 2 |
4 | 4 | */
|
5 | 5 |
|
6 | 6 | publicclassBasicCalculator {
|
@@ -76,7 +76,7 @@ private int compute(int a, int b, char operator) {
|
76 | 76 | publicstaticvoidmain(String[]args) {
|
77 | 77 | BasicCalculatorq =newBasicCalculator();
|
78 | 78 |
|
79 |
| -Strings ="2*6-(23+7)/(1+2)"; |
| 79 | +Strings ="2 *6-(23 + 7) / (1 +2)"; |
80 | 80 |
|
81 | 81 | intres =q.calculate(s);
|
82 | 82 | System.out.println(res);
|
|