title: Arithmetic Operator as enum?
body: <p>My program prompts a user to select one of the arithmetic operators (+, -, *, /) and stores their response in the variable <code>inOperator</code>. In the following case statement (located in main method), I'd like to correspondingly set a <code>positiveOperaton</code> and <code>negativeOperation</code>.</p>
  
  <pre><code>switch (inOperator){
          case 1: operator = '+';
              //positiveOperation = plus
              //negativeOperation = minus
          break;
  
          case 2: operator = '-';
              //positiveOperation = minus
              //negativeOperation = plus
          break;
  
         ...
      }
  </code></pre>
  
  <p>I've already created an enum that <em>initializes</em> the arithmetic operations:</p>
  
  <pre><code>public enum Operator
  {        
      plus("+") {
          @Override public double apply(double v1, double v2) {
          return v1 + v2;
          }
      },
      minus("-") {
          @Override public double apply(double v1, double v2) {
              return v1 - v2;
          }
      },
  
      ...
  
      private final String text;
      private Operator(String text) {
          this.text = text;
      }
      public abstract double apply(double x1, double x2);
      @Override public String toString() {
          return text;  
      }
  }
  </code></pre>
  
  <p>So going back to the case statement, how can I set a <code>positiveOperation</code> and <code>negativeOperation</code>? Could I create another enum that <em>initializes</em> the two?</p>