This commit is contained in:
2024-11-27 11:35:15 +01:00
parent 467af38a01
commit d39124f928
21 changed files with 902 additions and 56 deletions

View File

@@ -2,20 +2,25 @@ public class NoeudOperation extends Noeud{
public NoeudOperation(String ope){
this.val = ope;
for(int i=0;i<2;i++){
String prochainNoeud = Main.pile.pop();
if (prochainNoeud.equals("+")||prochainNoeud.equals("-")||prochainNoeud.equals("x")||prochainNoeud.equals("/")){
this.noeudGauche = new NoeudOperation(prochainNoeud);
}
else{
this.noeudGauche = new NoeudChiffre(prochainNoeud);
}
String prochainNoeud = Main.pile.pop();
if (prochainNoeud.equals("+")||prochainNoeud.equals("-")||prochainNoeud.equals("x")||prochainNoeud.equals("/")){
this.noeudGauche = new NoeudOperation(prochainNoeud);
}
else{
this.noeudGauche = new NoeudChiffre(prochainNoeud);
}
String prochainNoeud2 = Main.pile.pop();
if (prochainNoeud2.equals("+")||prochainNoeud2.equals("-")||prochainNoeud2.equals("x")||prochainNoeud2.equals("/")){
this.noeudDroit = new NoeudOperation(prochainNoeud2);
}
else{
this.noeudDroit = new NoeudChiffre(prochainNoeud2);
}
}
protected void afficherNoeud(){
System.out.print(val+" ");
this.noeudGauche.afficherNoeud();
this.noeudDroit.afficherNoeud();
this.noeudGauche.afficherNoeud();
}
}