TP
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user