| 1 | public class Calculator { |
| 2 | public int myAddition(int a, int b, int c) { |
| 3 | return a + b + c; |
| 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 | return (double) a / b; |
| 17 | } else { |
| 18 | throw new IllegalArgumentException("Division by zero is not allowed."); |
| 19 | } |
| 20 | } |
| 21 | } |