RealAdvanced.java 888B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /**
  2. * Method for the RealAdvanced class
  3. *
  4. * @Michelle DiMarino
  5. * @10.21.18
  6. */
  7. import java.util.*;
  8. public class RealAdvanced
  9. {
  10. public void realAdvanced()
  11. {
  12. Console.println("Please Select one of the following Calculations: " +"\n"+
  13. "1: x^2" + "\n"+
  14. "2: x^y" + "\n"+
  15. "3: 1/x" + "\n"+
  16. "4: Switch Sign of x" + "\n"+
  17. "5: Return to Main Menu");
  18. }
  19. // method to find x^2
  20. public double squared(double x){
  21. return Math.pow(x,2);
  22. }
  23. // method to find x^y
  24. public double exponent(double x, double y){
  25. return Math.pow(x,y);
  26. }
  27. // method to find the inverse of x
  28. public double inverse(double x){
  29. return 1/x;
  30. }
  31. // method to switch sign of x
  32. public double opposite(double x){
  33. double opposite1 = -1 * x;
  34. return opposite1;
  35. }
  36. }