123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
-
- /**
- * Write a description of class opSwitch here.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class opSwitch
- {
- public static void choose(String opInput){
- Console op = new Console();
-
- String x;
- String y;
- // switchboard for operations
- switch (opInput) {
- case "?":
- System.out.println("Commands include:\n"
- +"+"+"\n"
- +"-"+"\n"
- +"*"+"\n"
- +"/"+"\n"
- +"square"+"\n"
- +"square root"+"\n"
- +"exponent"+"\n"
- +"inverse"+"\n"
- +"invert"+"\n"
- +"quit"+"\n"
- +"clear"+"\n"
- +"reset"+"\n"
- +"M+"+"\n"
- +"MC"+"\n"
- +"MRC"+"\n"
- +"nth root"+"\n"
- +"log WIP"+"\n"
- +"ln WIP"+"\n"
- +"log (CHANGE OF BASE ) WIP"+"\n"
- +"sin"+"\n"
- +"cos"+"\n"
- +"tan"+"\n"
- +"asin"+"\n"
- +"acos"+"\n"
- +"atan"+"\n");
- break;
- case "+":
- //x = Console.getStringInput("Please enter first number.");
- y = Console.getStringInput("Please enter number.");
- simpleOp.add(op.currentNumber, Console.getNumber(y));
- break;
- case "-":
- //x = Console.getStringInput("Please enter first number.");
- y = Console.getStringInput("Please enter number.");
- simpleOp.sub(op.currentNumber, Console.getNumber(y));
- break;
- case "*":
- //x = Console.getStringInput("Please enter multiplicand.");
- y = Console.getStringInput("Please enter number.");
- simpleOp.mul(op.currentNumber, Console.getNumber(y));
- break;
- case "/":
- //x = Console.getStringInput("Please enter dividend.");
- y = Console.getStringInput("Please enter number.");
- simpleOp.div(op.currentNumber, Console.getNumber(y));
- break;
- case "square":
- //x = Console.getStringInput("Please enter your number.");
- simpleOp.squ(op.currentNumber);
- break;
- case "square root":
- //x = Console.getStringInput("Please enter your number.");
- simpleOp.sqrt(op.currentNumber);
- break;
- case "exponent":
- //x = Console.getStringInput("Please enter base.");
- y = Console.getStringInput("Please enter the exponent.");
- simpleOp.exp(op.currentNumber, Console.getNumber(y));
- break;
- case "inverse":
- //x = Console.getStringInput("Please enter your number.");
- simpleOp.inv(op.currentNumber);
- break;
- case "invert":
- simpleOp.invert(op.currentNumber);
- break;
- // default:
- // System.out.println("You have not provided valid input. Please enter \"?\" for a list of commands.");
- // break;
- case "M+":
- Memory.addMemory(op.currentNumber);
- break;
- case "MC":
- Memory.resetMemory();
- break;
- case "MRC":
- Memory.recallMemory();
- break;
- case "nth root":
- y = Console.getStringInput("Please enter the value of n.");
- advOp.nthRoot(op.currentNumber, Console.getNumber(y));
- break;
- case "log":
- advOp.log(op.currentNumber);
- break;
- case "sin":
- Trigonometry.sin(op.currentNumber);
- break;
- case "cos":
- Trigonometry.cos(op.currentNumber);
- break;
- case "tan":
- Trigonometry.tan(op.currentNumber);
- break;
- case "asin":
- Trigonometry.sinInverse(op.currentNumber);
- break;
- case "acos":
- Trigonometry.cosInverse(op.currentNumber);
- break;
- case "atan":
- Trigonometry.tanInverse(op.currentNumber);
- break;
- }
- }
-
- }
|