tp sur les ABR
This commit is contained in:
BIN
DEV.3.2/TP/TP8-ABR/1.Tri/Tri.class
Normal file
BIN
DEV.3.2/TP/TP8-ABR/1.Tri/Tri.class
Normal file
Binary file not shown.
62
DEV.3.2/TP/TP8-ABR/1.Tri/Tri.java
Normal file
62
DEV.3.2/TP/TP8-ABR/1.Tri/Tri.java
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
public class Tri {
|
||||||
|
|
||||||
|
private boolean estVide;
|
||||||
|
private double valeur;
|
||||||
|
private Tri filsGauche;
|
||||||
|
private Tri filsDroit;
|
||||||
|
|
||||||
|
public Tri() {
|
||||||
|
this.estVide = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Tri(double valeur) {
|
||||||
|
this.estVide = false;
|
||||||
|
this.valeur = valeur;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ajouter(double valeur) {
|
||||||
|
if(this.estVide) {
|
||||||
|
this.valeur = valeur;
|
||||||
|
this.estVide = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(valeur < this.valeur) {
|
||||||
|
if(this.filsGauche == null) {
|
||||||
|
this.filsGauche = new Tri();
|
||||||
|
}
|
||||||
|
filsGauche.ajouter(valeur);
|
||||||
|
} else {
|
||||||
|
if(this.filsDroit == null) {
|
||||||
|
this.filsDroit = new Tri();
|
||||||
|
}
|
||||||
|
filsDroit.ajouter(valeur);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
String aRenvoyer = "";
|
||||||
|
|
||||||
|
if(this.filsGauche != null) {
|
||||||
|
aRenvoyer += this.filsGauche.toString();
|
||||||
|
}
|
||||||
|
aRenvoyer += this.valeur + " ";
|
||||||
|
|
||||||
|
if(this.filsDroit != null) {
|
||||||
|
aRenvoyer += this.filsDroit.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
return aRenvoyer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Tri racine = new Tri();
|
||||||
|
|
||||||
|
for(String chaine : args) {
|
||||||
|
racine.ajouter(Double.parseDouble(chaine));
|
||||||
|
}
|
||||||
|
System.out.println(racine);
|
||||||
|
}
|
||||||
|
}
|
||||||
10
DEV.3.2/TP/TP8-ABR/2.Authentification/Authentification.java
Normal file
10
DEV.3.2/TP/TP8-ABR/2.Authentification/Authentification.java
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
public class Authentification {
|
||||||
|
|
||||||
|
private tr identifiant;
|
||||||
|
private mdp;
|
||||||
|
|
||||||
|
|
||||||
|
public Authentification() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user