TP03 fin ; TP04

This commit is contained in:
2022-02-08 17:20:59 +01:00
parent 759ba2dc5d
commit f24050cb7e
22 changed files with 263 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,16 @@
public class Compteur {
// attribut
private int compte;
// méthode
public void plusUn() {
this.compte++;
}
// autre méthode
public String toString() {
return Integer.toBinaryString(this.compte);
}
public Compteur() {
this.compte = 0;
}
}

Binary file not shown.

View File

@@ -0,0 +1,10 @@
public class Progression {
public static void main(String[] args) {
Compteur cp = new Compteur();
for (int i = 0; i < 9; i++) {
cp.plusUn();
if (i > 3) System.out.println(cp.toString());
}
}
}