A simple calculator built in Java using the console (terminal). This calculator supports the following operations:
- Addition
- Subtraction
- Multiplication
- Division (with zero-division handling)
- Console-based input/output
- Error handling for division by zero
- Clean and modular code with static methods for operations
JavaCalculator/ βββ src/ βββ task1/ βββ Calculator.java
markdown Copy code
- Java JDK installed (version 8 or later)
- Eclipse IDE or any Java IDE
- Clone the repository:
git clone https://github.com/Hindu309/JavaCalculator.git
Open the project in Eclipse:
Go to File > Open Projects from File System
Select the folder where you cloned the repo
Run the Calculator.java file:
Right-click on the file > Run As > Java Application
β Example Usage
Copy code ===== Java Console Calculator ===== Enter first number: 10 Enter second number: 2 Choose operation:
- Add
- Subtract
- Multiply
- Divide Enter choice: 4 Result: 5.0