Operations.java 775B

1234567891011121314151617181920212223242526272829303132333435363738
  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. public static int divide(int x, int y) {
  30. return x / y;
  31. }
  32. }