i am making a calculator in swing and need help with some logic.

so some of button my cal will have:

0,1,2,3,4,5,6,7,8,9,dot, mult,divide,mod, equal,sqrt, ln,log,sin,cos,tan, ^, exp, fractor, etc......

bc i have alot of buttons i need a good way to compute them.

here what i am thinking:

first user can hit as many numbers they want ex 3847.

than i can store in

```
i = 0;
String s[i] = "3847.5"
```

than when they hit op buttons than i can do i++ and add the op ex:

```
i++
String s[i] = "3847.5 +"
```

when they hit equal sign than i can have a function that compute the string.

only problem i see is there will be alot of errors to check for ex:

```
"* 3 / 3" error: *
"0 / 3" error: zero
"8.3.3 * 3" error: dot
"8.3 ++ 3" error: add
```

these are just some of the cases that i can think of but iam sure there are more.

if no error than compute left to right but computing might be problem too. bc i have to mult than divde than add.

```
String[] = "343 * 34.0 + 3 \ 3.2"
```

you guys have any better ways?