Help! URGENT.. i need to be able to evaluate PEMDAS expressions using stacks..

i need to use java for this.. i must evaluate a PEMDAS expression using stacks..

The ff are valid expressions:

1. (40 + 5 * 2^2)*10+2 Ans: 602

2. 2^-2+1 and 2^(-2)+1 Ans: 1.25

3. 4 + 5 * 3 + -1 and 4 + 5 * 3 + (-1) Ans: 18

4. 2^2^3*10 and 2^(2^3)*10 Ans: 2560 *Exponentiation is

right-associative

5. (2^2)^3*10 Ans: 640

6. -4 + 2 - -8 * -3 and (-4) + 2 - (-8) * (-3) Ans: -18

7. 5 / -1 * (6 + 1) and (5) / (-1) * (6 + 1) Ans: -35

8. 10 - 5 - 2 - 1 and (((10-5)-2)-1) Ans: 2

*Subtraction is

left-associative

9. 3 / 3 / 3 * 100 and ((3 / 3) / 3) * 100) Ans: 33.33

*Division is left-associative

10. 5 - 3 * +2 Ans: -1

while the ff are invalid:

1. 5 + 3 % 2

2. (9 * 6 + 8)^2)

3. 5 +^ 3

4. 5 ^/ 3

5. 5 + ( * 4

6. a + 5

7. (5-7)(68)

8. 3 - 5 +

please can anyone help me..? i badly need it.. a lot is at stake if i won't be able to do this..