update
This commit is contained in:
25
DEV.2.1/TP/TP4-ClassesetObjet/Progression.java
Normal file
25
DEV.2.1/TP/TP4-ClassesetObjet/Progression.java
Normal file
@@ -0,0 +1,25 @@
|
||||
public class Progression {
|
||||
|
||||
private int compte;
|
||||
|
||||
public void plusUn() {
|
||||
this.compte++;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return Integer.toBinaryString(this.compte);
|
||||
}
|
||||
|
||||
public Progression(int valeur_debut) {
|
||||
this.compte = valeur_debut;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Progression compteur = new Progression(5);
|
||||
|
||||
for (int i = 5; i <= 9; i++){
|
||||
System.out.println(compteur);
|
||||
compteur.plusUn();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user