I had to make a calculator using stacks. Here is what i have so far. For some reason, the equal sign doesn't work. Can someone help me fix this. The code shows no error, http://pastebin.com/SjemnE0V
Name:
Anonymous2012-12-03 0:49
Use printf debugging: make calculate() show a popup when it is called to see if it is called right. If that worked, then start putting them at different places throughout its logic and printing to see if it's doing what you expect. For example, have it print str to see if it's really one of the values you expect.
Speaking of str, you should have a default fallthrough at the end of that if-else chain to print an error if it gets an unexpected value:
if(str.equals("-")){
/* do stuff */
} else if(str.equals("+"){
/* do stuff */
} else {
show_popup("unexpected value of str: " + str);
}
And similarly in other places throughout your program.
When I saw ``Java programming calculator'', I immediately thought that it is a salary calculator for aspiring enterprise scalable n-tier turkey solutionist employees.