123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /**
  2. * Write a description of class opSwitch here.
  3. *
  4. * @author (your name)
  5. * @version (a version number or a date)
  6. */
  7. public class opSwitch
  8. {
  9. public static void choose(String opInput){
  10. Console op = new Console();
  11. String x;
  12. String y;
  13. // switchboard for operations
  14. switch (opInput) {
  15. case "?":
  16. System.out.println("Commands include:\n"
  17. +"+"+"\n"
  18. +"-"+"\n"
  19. +"*"+"\n"
  20. +"/"+"\n"
  21. +"square"+"\n"
  22. +"square root"+"\n"
  23. +"exponent"+"\n"
  24. +"inverse"+"\n"
  25. +"invert"+"\n"
  26. +"quit"+"\n"
  27. +"clear"+"\n"
  28. +"reset"+"\n"
  29. +"M+"+"\n"
  30. +"MC"+"\n"
  31. +"MRC"+"\n"
  32. +"nth root"+"\n"
  33. +"log"+"\n"
  34. +"sin"+"\n"
  35. +"cos"+"\n"
  36. +"tan"+"\n"
  37. +"asin"+"\n"
  38. +"acos"+"\n"
  39. +"atan"+"\n");
  40. break;
  41. case "+":
  42. //x = Console.getStringInput("Please enter first number.");
  43. y = Console.getStringInput("Please enter number.");
  44. simpleOp.add(op.currentNumber, Console.getNumber(y));
  45. break;
  46. case "-":
  47. //x = Console.getStringInput("Please enter first number.");
  48. y = Console.getStringInput("Please enter number.");
  49. simpleOp.sub(op.currentNumber, Console.getNumber(y));
  50. break;
  51. case "*":
  52. //x = Console.getStringInput("Please enter multiplicand.");
  53. y = Console.getStringInput("Please enter number.");
  54. simpleOp.mul(op.currentNumber, Console.getNumber(y));
  55. break;
  56. case "/":
  57. //x = Console.getStringInput("Please enter dividend.");
  58. y = Console.getStringInput("Please enter number.");
  59. simpleOp.div(op.currentNumber, Console.getNumber(y));
  60. break;
  61. case "square":
  62. //x = Console.getStringInput("Please enter your number.");
  63. simpleOp.squ(op.currentNumber);
  64. break;
  65. case "square root":
  66. //x = Console.getStringInput("Please enter your number.");
  67. simpleOp.sqrt(op.currentNumber);
  68. break;
  69. case "exponent":
  70. //x = Console.getStringInput("Please enter base.");
  71. y = Console.getStringInput("Please enter the exponent.");
  72. simpleOp.exp(op.currentNumber, Console.getNumber(y));
  73. break;
  74. case "inverse":
  75. //x = Console.getStringInput("Please enter your number.");
  76. simpleOp.inv(op.currentNumber);
  77. break;
  78. case "invert":
  79. simpleOp.invert(op.currentNumber);
  80. break;
  81. // default:
  82. // System.out.println("You have not provided valid input. Please enter \"?\" for a list of commands.");
  83. // break;
  84. case "M+":
  85. Memory.addMemory(op.currentNumber);
  86. break;
  87. case "MC":
  88. Memory.resetMemory();
  89. break;
  90. case "MRC":
  91. Memory.recallMemory();
  92. break;
  93. case "nth root":
  94. y = Console.getStringInput("Please enter the value of n.");
  95. advOp.nthRoot(op.currentNumber, Console.getNumber(y));
  96. break;
  97. case "log":
  98. advOp.log(op.currentNumber);
  99. break;
  100. case "sin":
  101. Trigonometry.sin(op.currentNumber);
  102. break;
  103. case "cos":
  104. Trigonometry.cos(op.currentNumber);
  105. break;
  106. case "tan":
  107. Trigonometry.tan(op.currentNumber);
  108. break;
  109. case "asin":
  110. Trigonometry.sinInverse(op.currentNumber);
  111. break;
  112. case "acos":
  113. Trigonometry.cosInverse(op.currentNumber);
  114. break;
  115. case "atan":
  116. Trigonometry.tanInverse(op.currentNumber);
  117. break;
  118. case "made by":
  119. System.out.println("EXCESSIVE MENACE IS:\nWill Brown\nDe'Jon Johnson\nNed Redmond");
  120. break;
  121. }
  122. }
  123. }