Java different Calculator basic functions problem?
<p>The code below is a chunk from actual code of Calculator.What it does is that user presses a number on the calculator then as he presses "+" the number on the text field gets stored and then he presses the next number and it gets stored when he presses "=".Then in "=" if condition the addition function is performed.Now i want both addition and subtraction running at one time that is after doing addition user wants to do subtraction then HOW will i do it???? </p>

<pre><code>if(a.getActionCommand().equals("+"))
{
   q=tf.getText();
   x=Integer.parseInt(q);
}

if(a.getActionCommand().equals("-"))
{
   b=tf.getText();
   t=Integer.parseInt(b);
}
if(a.getActionCommand().equals("="))
{
   p=tf.getText();
   y=Integer.parseInt(p);
   z=x+y;
   //z=t-y;
   w=Integer.toString(z);
   tf.setText(w);
}
</code></pre>
