/**
 * A simple calculator.
 *
 * @author  Prof. David Bernstein, James Madison University
 * @version 1.0
 */
public class Calculator
{
    /**
     * The entry point of the application.
     *
     * @param args  Syntax: left-operand operator right operand
     */
    public static void main(String[] args)
    {
       char           operator;
       int            left, result, right;

       try 
       {
          result = 0;

          left  = Integer.parseInt(args[0]);
          right = Integer.parseInt(args[2]);

          operator = args[1].charAt(0);
	    
          switch (operator) 
          {
             case '+': 
                result = left + right;
                break;

             case '-': 
                result = left - right;
                break;

             case '/': 
                result = left / right;
                break;
          }
          System.out.println("Result: "+result);
       } 
       catch (ArithmeticException ae) 
       {
          System.out.println("Does not compute!");
       } 
       catch (NumberFormatException nfe) 
       {
          System.out.println("Non-numeric operand!");
       }
    }
}
