Operations.java 935B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. */
  9. public static int add(int x, int y) {
  10. return x + y;
  11. }
  12. /**
  13. * The subtraction function
  14. * @param x The first operand
  15. * @param y The second operand
  16. * @return y taken from x
  17. */
  18. public static int subtract(int x, int y) {
  19. return x - y;
  20. }
  21. /**
  22. * The multiplication function
  23. * @param x The first operand
  24. * @param y The second operand
  25. * @return x times y
  26. */
  27. public static int multiply(int x, int y) {
  28. return x * y;
  29. }
  30. /**
  31. * The division function
  32. * @param x The first operand
  33. * @param y The second operand
  34. * @return x divide y
  35. */
  36. public static int divide(int x, int y) {
  37. return x / y;
  38. }
  39. }