Scanner as an argument is not necessary here.

I would suggest, in order, that you

 1. Implement something that works on simple binary operations.
 2. Implement something to parse out those operations from string form.
 3. Add in dialogue to interface with the user.
 4. Take in command line arguments.


A Simple example that illustrates all 4 of the above:

First an operator enumeration.

    public enum Operator {
    	ADD('+'),
    	SUBTRACT('-'),
    	MULTIPLY('*'),
    	DIVIDE('/'),
    	MOD('%'),
    	EXPONENTIATE('^');
    
    	private final char symbol;
    
    	Operator(char symbol) {
    		this.symbol = symbol;
    	}
    
    	public char symbol() {
    		return symbol;
    	}
    
    	@Override
    	public String toString() {
    		return name().charAt(0) + name().substring(1).toLowerCase();
    	}
    }

For now, you can think of an enumeration as a useful way to store related series of values that won't change. A calculator is a good opportunity to look into them rather than referencing the values directly, and if you're curious there's an interesting way we can apply them to the purpose of a calculator.


Then the calculator program itself.

import java.util.Scanner;

    public class Calculator{
    	public static void main(String[] args) {
    		if (args.length == 3) {
    			System.out.println(calculate(args));
    		} else {
    			Scanner input = new Scanner(System.in);
    			System.out.print("Enter a binary calculation: ");
    			System.out.println(calculate(input.nextLine().split("\\s+")));
    		}
    	}
    
    	private static double calculate(String[] args) {
    		if (args.length != 3) {
    			throw new IllegalArgumentException("Can only calculate binary operations");
    		}
    		
    		double input1 = Double.parseDouble(args[0]);
    		char operator = args[1].charAt(0);
    		double input2 = Double.parseDouble(args[2]);
    		
    		if (input2 == 0 && (operator == Operator.DIVIDE.symbol() || operator == Operator.MOD.symbol())) {
    			throw new IllegalArgumentException("Cannot divide by 0");
    		}
    
    		return calculation(input1, operator, input2);
    	}
    
    	private static double calculation(double input1, char operator, double input2) {
    		double result = 0;
    		switch(operator) {
    			case '+':
    				result = input1 + input2;
    			break;
    			case '-':
    				result = input1 - input2;
    			break;
    			case '*':
    				result = input1 * input2;
    			break;
    			case '/':
    				result = input1 / input2;
    			break;
    			case '%':
    				result = input1 % input2;
    			break;
    			case '^':
    				result = Math.pow(input1, input2);
    			break;
    		}
    		return result;
    	}
    }


Notice that I optionally directly accept argument which is something desirable for a CLI. This example has **a lot** you can still improve on, including input validation and a more direct utilization of the enumeration among other things.

If you're unfamiliar with the [split][1] function I'm simply converting whatever the user gives us to a String array, with the indexes separated by spaces (what the regex "\\s++" means).  so I may treat it as if it was invoked from the command line. If you want to learn more about Regex, you can check out other [patterns][2] or use HackerRank's decent introduction/practice platform [here][3].


  [1]: https://docs.oracle.com/javase/7/docs/api/java/lang/String.html#split(java.lang.String)
  [2]: https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html
  [3]: https://www.hackerrank.com/domains/regex/re-introduction