https://github.com/habbes/java-calc
Simple Calculator Interpreter in Java to demonstrate basic OOP principles and program design.
https://github.com/habbes/java-calc
calculator interpreter java oop
Last synced: 8 months ago
JSON representation
Simple Calculator Interpreter in Java to demonstrate basic OOP principles and program design.
- Host: GitHub
- URL: https://github.com/habbes/java-calc
- Owner: habbes
- Created: 2021-01-17T18:18:29.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-01-17T19:19:01.000Z (over 5 years ago)
- Last Synced: 2025-04-03T05:19:35.010Z (about 1 year ago)
- Topics: calculator, interpreter, java, oop
- Language: Java
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Simple Calculator
Simple Calculator/Interpreter in Java to demonstrate basic OOP principles and program design.
## How to run:
Clone the repo, and run the command:
```
./run.sh
```
This will compile and run the program:
```
Welcome to the calculator. Enter an expression and press Return at the prompt:
> let x = 10 + 4
14
> let y = x * 2
28
> 200 + y - x
214
> exit
Bye!
```
## Features and limitations:
- Supports basic arithmetic operations like: `3 * 500 / 20 + 10`
- Supports variables assignment:`let x = 10 * 2` and use: `3 + x / 2`
- Strict syntax that requires a single space between each pair of tokens (e.g. `3+ 2` is **invalid syntax**)
- Operations are evaluated left to right with **no regard for operator precedence** (i.e. `3 + 2 * 3` will return 15 instead 9)