Professional Documents
Culture Documents
Eval
Eval
Scanner;
}
static int pilecalcul(pille p) {
pille p1=new pille();
if ((p.sommet().toString().charAt(0)!='+')||(p.sommet().toString().charAt(0)!
='-')||(p.sommet().toString().charAt(0)!='*')||(p.sommet().toString().charAt(0)!
='/')) {
int a= Integer.parseInt(p.sommet().toString());
p.depiler();
int b= Integer.parseInt(p.sommet().toString());
p.depiler();
switch (p.sommet().toString().charAt(0)) {
case '+': p.empiler(a+b);
break;
case '*': p.empiler(a*b);
break;
case '-': p.empiler(a-b);
break;
case '/': p.empiler(a/b);
break;
}
}
else
p1.empiler(p.sommet());
return pilecalcul(p);
}
}