I understood what you are trying to do but I think you should write it again. because it wont work. ok here how you should write it.
1 ) make a loop that turns until there is no token left on scanner.
and this is not it. input variable stores first interger token. which is 7 so it will loop 7 times
2) if next token is number put next token in stack if it is not number it shuld be + - * or / then pop 2 number from stack and do the calculation and put result back in stack.at the and you should have only one. number and it will be result.
note) if at the end ,there is more than one number in stack given string is not valid. when you got an operator from scanner and there is less than two number in stack string is not valid. and if string you got is not number nor operator string is not valid. good luck.
(
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.