title: How to Correctly Accept Arithmetic Operators as User Input
body: <p><strong>Problem : My program is not recognizing my arithmetric operator input</strong></p>
  <p>I run into problems when the program tries to identify my arithmetic operator. I've tried to use quotes i.e( &quot;+&quot;, &quot;-&quot;, etc.) and no qoutes i.e (+, -,, etc.) but I still can't get the program to complete an equation. What should I do to fix this problem?</p>
  <p><strong>Output</strong></p>
  <p>****Choose 1 number between 200 and 1000...</p>
  <p>800</p>
  <p>Choose another number between 200 and 1000...</p>
  <p>800</p>
  <p>Choose an operator (+ , - , * or /)</p>
  <p>&quot;+&quot;</p>
  <p>is not a valid operator</p>
  <p>Invalid Entry****</p>
  <hr />
  <p><strong>Full Program</strong></p>
  <pre><code>//This program takes to double values and an arithmetic operator from the user and does a basic arithmetic equation
  //based on user input using conditional statements and scanners
  
   import java.util.Scanner;
  
   public class Assignment_2{
  
   public static void main(String[] args){
  
  // intialize scanners
  Scanner DoubleScan = new Scanner (System.in);
  Scanner OpScan = new Scanner (System.in);
  
  // prompt user for first number
  System.out.println(&quot;Choose 1 number between 200 and 1000...&quot;);
  
  // accept first user input as double
  Double doublein1 = DoubleScan.nextDouble();
  
  //store first user input as string
  String doublein1str = Double.toString(doublein1);
  
  //prompt user for second number 
  System.out.println(&quot;Choose another number between 200 and 1000...&quot;);
  
  //accept second user input at double
  Double doublein2 = DoubleScan.nextDouble();
  
  //store second user input as string
  String doublein2str = Double.toString(doublein2);
  
  //prompt user for arithmetic operator choice
  System.out.println(&quot;Choose an operator (+ , - , * or /)&quot;);
  
  //accept user arithmetic operator choice
  String Op = OpScan.next();
  
  //if numbers entered are not between 200 and 100 create error message
  if (!(200 &lt; doublein1 &amp;&amp; doublein2 &lt;= 1000)){
      
      System.err.println(doublein1 + &quot; or &quot; + doublein2 + &quot; is not a valid number&quot;);
  
  }
  
  //if operators are not +, -, *, or / create an error message
  if (!(Op == &quot;+&quot;|| Op == &quot;-&quot; || Op == &quot;*&quot; || Op == &quot;/&quot;)){
      
      System.err.println(Op + &quot; is not a valid operator&quot;);
  }
  
  //depending on which operator is chosen calcutate accordingly with numbers 1 and 2 
  if(Op == &quot;+&quot;){
      System.out.println(&quot;Evaluation: &quot; + doublein1str + &quot; + &quot; + doublein2str + &quot; = &quot; + (doublein1 + doublein2));
  
  } else if (Op == &quot;-&quot;){
      System.out.println(&quot;Evaluation: &quot; + doublein1str + &quot; - &quot; + doublein2str + &quot; = &quot; + (doublein1 - doublein2)); 
  
  } else if (Op == &quot;*&quot;){
      System.out.println(&quot;Evaluation: &quot; + doublein1str + &quot; * &quot; + doublein2str + &quot; = &quot; + (doublein1 * doublein2));
  
  } else if (Op == &quot;/&quot;){
      System.out.println(&quot;Evaluation: &quot; + doublein1str + &quot; / &quot; + doublein2str + &quot; = &quot; + (doublein1 / doublein2));
  
      // if operator does not match any above inform user of invalid entry
  } else;{
      System.out.println(&quot;Invalid Entry&quot;);
  }
  
   // close scanners   
  DoubleScan.close();
  OpScan.close();
  
  
  //end
  }
  [I think something is wrong in this section of the code][1]}
  </code></pre>