/** * 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){ simpleOp op = new simpleOp(); 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"); 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; } // //if/else state // if(opInput.equals("add") || opInput.equals("+")){ // String addRequest1 = Console.getStringInput("Whats the first number you'll like to add?"); // String addRequest2 = Console.getStringInput("Whats the second number you'll like to add?"); // simpleOp.add(Console.getInput(addRequest1), Console.getNumber(addRequest2)); // }else if(opInput.equals("invert")){ // String invertRequest = Console.getStringInput("What number would you like to invert?"); // simpleOp.invert(Console.getInput(invertRequest)); // } }