Operations.java 800B

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