diff options
| author | krolxon <krolyxon@tutanota.com> | 2024-02-15 00:09:10 +0530 |
|---|---|---|
| committer | krolxon <krolyxon@tutanota.com> | 2024-02-15 00:09:10 +0530 |
| commit | d134acdbc12a2d16dadc129f233daeec2b1c9fb8 (patch) | |
| tree | aef6fe3c0e17be3fcc6e4462cc8ce96bba44bb06 /Calculator.java | |
| parent | 4cea67a0cb77359b83a9d6e40b060fefc2591ce5 (diff) | |
fix duplicate digit at end
Diffstat (limited to 'Calculator.java')
| -rw-r--r-- | Calculator.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Calculator.java b/Calculator.java index 031fa57..43804c3 100644 --- a/Calculator.java +++ b/Calculator.java @@ -1,8 +1,14 @@ public class Calculator { public static void main(String[] args) { String expr = "(84 / 4 * 3 - 9) * 2 + 1 / 5"; // 108.2 - Parser p = new Parser(expr); + Parser p; + if (args.length == 0) { + p = new Parser(expr); + } else { + p = new Parser(args[0]); + } String postfix = p.toPostFix(); + // System.out.println("pfix => \t " + postfix); System.out.println(p.evalExpr(postfix)); } } |
