in a program so that I don't have to press enter in order to get a result but spacebar instead? ...and secondly why is this not working
import java.io.*;
public class askisi1aApp
{
public static void main (String args[]) throws IOException
{
char operator;
int operand;
int result;
char answer;
do
{
result = my.readInt ();
//System.out.print (result + " ");
operator = (char) System.in.read ();
while( operator != '=')
{
operand = my.readInt ();
switch (operator)
{
case '+': result += operand;
break;
case '-': result -= operand;
break;
case '*': result *= operand;
break;
case '/': result /= operand;
break;
default: System.out.println ("invalid operator");
System.exit (1);
}
//System.out.print (operator + " ");
//System.out.print (operand + " ");
operator = (char) System.in.read ();
}
System.in.skip (2);
System.out.println (/*"= " + */result);
System.out.print ("try again (Y/N) ?");
answer = (char) System.in.read ();
}
while (answer=='Y' || answer=='y');
}
}
the idea is to make a program that calculates from left to right like that : 5 + 10 * 2 = 30
please help...
