Making a simple calculator: cannot exit loop or give answer
<p>I need to make a simple calculator. I am having trouble with entering any amount of operators and operands, then outputting the answer when the equals button has been entered.</p>

<p>So far, if I just press one number and a digit it exits but does not give me an answer. If I do more than one operator and operand then <code>=</code> it does not exit the loop.
For example it should be like:</p>

<pre><code>5
+
5
+
5
=
15 
</code></pre>

<p>Here is my code, Calculator:</p>

<pre><code>public interface Calculator {
    public void setOperator(char operator);         // eg +-*/=
    public void setOperand (double operand);        // eg 123.456
    public double getResult();
}
</code></pre>

<p>SimpleCalculator:</p>

<pre><code>import java.io.*;

public class SimpleCalculator implements Calculator {
    char operator;
    double operand;
    double result;
    double answer;

    public void setOperator(char operator){
        this.operator = operator;
    }

    public char getOperator(){
        return operator;
    }

    public void setOperand(double operand){
        this.operand = operand;
    }
    public double getOperand(){
        return operand;
    }

    public double getResult(){
        if (getOperator() == '+'){
            result = (getOperand() + getOperand());
        }
        if (getOperator() == '-'){
            result = (getOperand() - getOperand());
        }
        if (getOperator() == '*'){
            result = (getOperand() * getOperand());
        }
        if (getOperator() == '/')
        {
            result = (getOperand() / getOperand());
        }
        if (getOperator() == '=')
            result =  answer;
    }

    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");
            }
        }
        return isnum;
    }
}
</code></pre>

<p>SimpleTest:</p>

<pre><code>import java.io.*;

public class SimpleTest{
    static String value;
    static double operand;
    static char operator;
    static  boolean isnum;

    public static void main(String[] argv){
        SimpleCalculator calculator = new SimpleCalculator();
        value = UserInput.readString();
        while (!(value.equals("=")))
        {
            isnum = calculator.getanswer(value);
            if (!(isnum == true))
            {
                break;
            }
        }
        System.out.println(calculator.getResult());
    }

}
</code></pre>
