(

)

%

C

7

8

9

÷

4

5

6

x

1

2

3

-

0

.

=

+

My Algorithm
On Click of Equals Button:
  1. Read entire equation string
  2. Check for parentheses
    1. If parentheses present:
      1. Create subequation by parsing the string between the inner-most set of parentheses
      2. Remove that set of parentheses
      3. Calculate that subequation
      4. Replace the original parentheses string with newly calculated subequation
      5. Repeat check for parentheses
    2. If parentheses not present:
      1. Calculate equation
  3. Set final calculation in the text input
Other Notes:
  1. Equation and sub equations are parsed by placing values and operators into a single arrays
  2. Percents are parsed prior to calculating the equation
  3. Calculation follows order of operations