I am making a post fix calculator and i can not figure out how to do functions without having an equal sign. For example " a = 3 5 + " will print 8 , but " 3 5 + " will make the program crash. Here is what i have so far
if (values.peek().matches("[a-z]") || values.search("=") > -1 )
{
String a = values.pop();
values.pop();
double answer = compute(values);
memory.put(a, answer);
var.add(a);
System.out.println(" " + answer);
}
else
{
double answer = compute(values);
System.out.println(answer);
}