You need to rework your if statements. All the other (- / %) are kinda on the right track but you are comparing each value returned from indexOf to pos. Get rid of pos and compare the returned value...
Type: Posts; User: Junky
You need to rework your if statements. All the other (- / %) are kinda on the right track but you are comparing each value returned from indexOf to pos. Get rid of pos and compare the returned value...
int pos = expr.indexOf("+");
What happens when the user enters an expression that is not addition? The indexOf method returns -1 when it cannot find the target char.