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.
2 parents a901403 + 3cfe6f4 commit 7e97177Copy full SHA for 7e97177
Calculator.java
@@ -0,0 +1,9 @@
1
+public class Calculator {
2
+ public int add(int a, int b) { return a + b; }
3
+ public int subtract(int a, int b) { return a - b; }
4
+ public int multiply(int a, int b) { return a * b; }
5
+ public double divide(int a, int b) {
6
+ if (b == 0) throw new ArithmeticException("Divide by zero");
7
+ return (double) a / b;
8
+ }
9
+}
0 commit comments