We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 44b5865 commit fceeb7aCopy full SHA for fceeb7a
src/main/java/com/thealgorithms/Calculator.java
@@ -0,0 +1,16 @@
1
+public class Calculator {
2
+ // ADDITION
3
+ public double add(double a, double b) { return a + b; }
4
+ // SUBTRACTION
5
+ public double sub(double a, double b) { return a - b; }
6
+ // MULTIPLICATION
7
+ public double mul(double a, double b) { return a * b; }
8
+ // DIVISION
9
+ public double div(double a, double b) {
10
+ if (b == 0) {
11
+ System.out.println("Error: Division by zero!");
12
+ return 0;
13
+ }
14
+ return a / b;
15
16
+}
0 commit comments