29 Novembre
This commit is contained in:
21
DEV3.2/TP7/Prefixe/NoeudOperation.java
Normal file
21
DEV3.2/TP7/Prefixe/NoeudOperation.java
Normal file
@@ -0,0 +1,21 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void afficherNoeud(){
|
||||
System.out.print(val+" ");
|
||||
this.noeudGauche.afficherNoeud();
|
||||
this.noeudDroit.afficherNoeud();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user