I did a something similar for spreadsheet app. It handled ()-+*/^ and cell references. I used one stack for operators and another stack for values. Doing a search on polish notation should help. The basic approach is:
1) Break the string into tokens.
2) grab a token.
3) check if it is an operator or value
4) put it on the proper stack.
As you go when you get an operator you check if
you should evaluate what has come before. If you need to evaluate then you do and place the result on the value stack.
So something like this: 3+4*2 vs (3+4)*2
3+4*2:
1) get 3 place in value stack
2) get + place in operator stack
3) get 4 place in value stack
4) get * place in operator stack
5) get 2 place in value stack
end of equation
6) pop top operator and top two values
7) evaluate
8) place on value stack
9) repeate 6-8
(3+4)*2:
1) get ( place on operator stack
2) get 3 place in value stack
3) get + place in operator stack
4) get 4 place in value stack
5) get ) triggers precidence rule
6) pop operator and two values
7) evaluate
8) place value on value stack
9) pop operator, matching parens, continue
10) get * place on operator stack
11) get 2 place on value stack
12) end of line evaluate.
I've left out
alot of how to do the logic, but that should get you headed in the right direction.