Calculator.java 1008B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /**
  2. * Write a description of class Calculator here.
  3. *
  4. * @author (your name)
  5. * @version (a version number or a date)
  6. */
  7. public class Calculator
  8. {
  9. public static double add(double x, double y) {
  10. double result = x+y;
  11. return result;
  12. }
  13. public static double subtract(double x, double y) {
  14. double result = x-y;
  15. return result;
  16. }
  17. public static double multiply(double x, double y) {
  18. double result = x*y;
  19. return result;
  20. }
  21. public static double divide(double x, double y) {
  22. double result = x/y;
  23. return result;
  24. }
  25. public static double square(double x) {
  26. double result = Math.pow(x, 2);
  27. return result;
  28. }
  29. public static double inverse(double x) {
  30. double result = x;
  31. return result;
  32. }
  33. public static double tangent(double x) {
  34. double result = Math.tan(x);
  35. return result;
  36. }
  37. public static double itan(double x) {
  38. double result = Math.atan(x);
  39. return result;
  40. }
  41. }