RealAdvanced.java 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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: Absolute Value of x" + "\n"+
  18. "6: Square Root of x" + "\n"+
  19. "7: Return to Main Menu");
  20. }
  21. // method to find x^2
  22. public double squared(double x){
  23. return Math.pow(x,2);
  24. }
  25. // method to find x^y
  26. public double exponent(double x, double y){
  27. return Math.pow(x,y);
  28. }
  29. // method to find the inverse of x
  30. public double inverse(double x){
  31. return 1/x;
  32. }
  33. // method to switch sign of x
  34. public double opposite(double x){
  35. double opposite1 = -1 * x;
  36. return opposite1;
  37. }
  38. public double absoluteValue(double x){
  39. return Math.abs(x);
  40. }
  41. public double sqrt(double x){
  42. return Math.sqrt(x);
  43. }
  44. }