123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. simpleOp op = new simpleOp();
  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. +"x rooted WIP"+"\n"
  30. +"log WIP"+"\n"
  31. +"ln WIP"+"\n"
  32. +"log (CHANGE OF BASE ) WIP"+"\n"
  33. +"sin WIP"+"\n"
  34. +"cos WIP"+"\n"
  35. +"tan WIP"+"\n"
  36. +"inverse of sin WIP"+"\n"
  37. +"inver of cos WIP"+"\n"
  38. +"inverse of tan WIP"+"\n");
  39. break;
  40. case "+":
  41. //x = Console.getStringInput("Please enter first number.");
  42. y = Console.getStringInput("Please enter number.");
  43. simpleOp.add(op.currentNumber, Console.getNumber(y));
  44. break;
  45. case "-":
  46. //x = Console.getStringInput("Please enter first number.");
  47. y = Console.getStringInput("Please enter number.");
  48. simpleOp.sub(op.currentNumber, Console.getNumber(y));
  49. break;
  50. case "*":
  51. //x = Console.getStringInput("Please enter multiplicand.");
  52. y = Console.getStringInput("Please enter number.");
  53. simpleOp.mul(op.currentNumber, Console.getNumber(y));
  54. break;
  55. case "/":
  56. //x = Console.getStringInput("Please enter dividend.");
  57. y = Console.getStringInput("Please enter number.");
  58. simpleOp.div(op.currentNumber, Console.getNumber(y));
  59. break;
  60. case "square":
  61. //x = Console.getStringInput("Please enter your number.");
  62. simpleOp.squ(op.currentNumber);
  63. break;
  64. case "square root":
  65. //x = Console.getStringInput("Please enter your number.");
  66. simpleOp.sqrt(op.currentNumber);
  67. break;
  68. case "exponent":
  69. //x = Console.getStringInput("Please enter base.");
  70. y = Console.getStringInput("Please enter the exponent.");
  71. simpleOp.exp(op.currentNumber, Console.getNumber(y));
  72. break;
  73. case "inverse":
  74. //x = Console.getStringInput("Please enter your number.");
  75. simpleOp.inv(op.currentNumber);
  76. break;
  77. case "invert":
  78. simpleOp.invert(op.currentNumber);
  79. break;
  80. // default:
  81. // System.out.println("You have not provided valid input. Please enter \"?\" for a list of commands.");
  82. // break;
  83. case "x rooted":
  84. break;
  85. case "log":
  86. break;
  87. case "ln":
  88. break;
  89. case "log (change of base)":
  90. break;
  91. case "sin":
  92. break;
  93. case "cos":
  94. break;
  95. case "tan":
  96. break;
  97. case "inverse of sin":
  98. break;
  99. case "inverse of cos":
  100. break;
  101. case "inverse of tan":
  102. break;
  103. }
  104. }
  105. }