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 f03de6c commit 48b8cc8Copy full SHA for 48b8cc8
Calculator.java
@@ -0,0 +1,20 @@
1
+public class Calculator {
2
+ public int add(int a, int b) {
3
+ return a + b;
4
+ }
5
+
6
+ public int subtract(int a, int b) {
7
+ return a - b;
8
9
10
+ public int multiply(int a, int b) {
11
+ return a * b;
12
13
14
+ public double divide(int a, int b) {
15
+ if (b == 0) {
16
+ throw new IllegalArgumentException("Division by zero is not allowed.");
17
18
+ return (double) a / b;
19
20
+}
0 commit comments