Simple Calculator problem, not reading in answer
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/5396840/making-a-simple-calculator-cannot-exit-loop-or-give-answer">Making a simple calculator cannot exit loop or give answer</a>  </p>
</blockquote>



<p>hi, so basically my code at the moment takes the last value in and does the calculation with the same number 
so 
5+6=12
how can i store the operands and then use them in the calculation</p>

<pre><code> public double getResult(){

      if (getOperator() == '+')
          {

             result = (getOperand() + getOperand());

          }

             if (getOperator() == '-')

          {

             result = (getOperand() - getOperand());

          }

          if (getOperator() == '*')

          {

             result = (getOperand() * getOperand());

          }

          if (getOperator() == '/')

          {

             result = (getOperand() / getOperand());

          }


          return result;

    }


public boolean getanswer(String value)

{

boolean isnum = false;

 try {

         setOperand(Double.parseDouble(value));

         operand = (Double.parseDouble(value));

         getResult();

         isnum =  true;



    }

 catch(Exception e)

 {

        try {

          setOperator(value.charAt(0));

          operator = (value.charAt(0));

          isnum = false;

        }

        catch(Exception e2)

        {

         System.out.println("Enter a number");

        }
</code></pre>
