1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /**
  2. * Write a description of class simpleOp here.
  3. *
  4. * @author (your name)
  5. * @version (a version number or a date)
  6. */
  7. import java.util.*;
  8. public class simpleOp
  9. {
  10. public static double currentNumber = 0;
  11. // public static double NumberOne(){
  12. // String getFirst = Console.getStringInput("Please enter number.");
  13. // currentNumber = Console.getNumber(getFirst);
  14. // return currentNumber;
  15. // }
  16. public static double add(double x, double y){
  17. //CALULATES THE SUM OF TWO NUMBERS
  18. currentNumber = x + y;
  19. //System.out.println(currentNumber);
  20. return currentNumber;
  21. }
  22. public static double sub(double x, double y){
  23. //CALULATES THE DIFFERENCE OF TWO NUMBERS
  24. currentNumber = x - y;
  25. //System.out.println(currentNumber);
  26. return currentNumber;
  27. }
  28. public static double mul(double x, double y){
  29. //CALULATES THE PRODUCT OF TWO NUMBERS
  30. currentNumber = x * y;
  31. //System.out.println(currentNumber);
  32. return currentNumber;
  33. }
  34. public static double div(double x, double y){
  35. //CALULATES THE QUOTIENT OF TWO NUMBERS
  36. currentNumber = x / y;
  37. //System.out.println(currentNumber);
  38. return currentNumber;
  39. }
  40. public static double squ(double x){
  41. //CALULATES THE SQUARE OF ONE NUMBER
  42. //CASTED TO double FOR NOW... IT'S IN ALPHA, YOU DIG?
  43. currentNumber = Math.pow(x,2);
  44. //System.out.println(currentNumber);
  45. return currentNumber;
  46. }
  47. public static double sqrt(double x){
  48. //CALULATES THE SQUARE ROOT OF ONE NUMBER
  49. //CASTED TO double FOR NOW... IT'S IN ALPHA, YOU DIG?
  50. currentNumber = Math.sqrt(x);
  51. //System.out.println(currentNumber);
  52. return currentNumber;
  53. }
  54. public static double exp(double x, double y){
  55. //CALULATES EXPONENTIATION OF X TO POWER OF Y
  56. //CASTED TO double FOR NOW... IT'S IN ALPHA, YOU DIG?
  57. currentNumber = Math.pow(x,y);
  58. //System.out.println(currentNumber);
  59. return currentNumber;
  60. }
  61. public static double inv(double x){
  62. //CALULATES THE INVERSE OF NUMBER
  63. //CASTED TO double FOR NOW... IT'S IN ALPHA, YOU DIG?
  64. currentNumber = (1/x);
  65. //System.out.println(currentNumber);
  66. return currentNumber;
  67. }
  68. public static double invert(double x){
  69. //TURNS NEGATIVE TO POSITIVE OR POSITIVE TO NEGATIVE
  70. currentNumber = -x;
  71. //System.out.println(currentNumber);
  72. return currentNumber;
  73. }
  74. }