Skip to content

Commit 7e97177

Browse files
authored
Merge pull request #1 from AriyaArKa/feature/calculator
calcu.java added
2 parents a901403 + 3cfe6f4 commit 7e97177

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Calculator.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)