Operations.java 791B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. public class Operations {
  2. /**
  3. * The addition function.
  4. * @param x The first operand
  5. * @param y The second operand
  6. * @return the sum of x and y
  7. */
  8. public static int add(int x, int y) {
  9. return x + y;
  10. }
  11. /**
  12. * The subtraction function
  13. * @param x The first operand
  14. * @param y The second operand
  15. * @return y taken from x
  16. */
  17. public static int subtract(int x, int y) {
  18. return x - y;
  19. }
  20. /**
  21. * The multiplication function
  22. * @param x The first operand
  23. * @param y The second operand
  24. * @return x times y
  25. */
  26. public static int multiply(int x, int y) {
  27. return x * y;
  28. }
  29. // The Divide Function
  30. public static int divide(int x, int y){
  31. return x / y;
  32. }
  33. }