TP4
This commit is contained in:
BIN
APL2.1/TP4/Progression/Compteur.class
Normal file
BIN
APL2.1/TP4/Progression/Compteur.class
Normal file
Binary file not shown.
18
APL2.1/TP4/Progression/Compteur.java
Normal file
18
APL2.1/TP4/Progression/Compteur.java
Normal file
@@ -0,0 +1,18 @@
|
||||
public class Compteur {
|
||||
private int compte;
|
||||
public Compteur() {
|
||||
this.compte = 0;
|
||||
}
|
||||
public Compteur(int h) {
|
||||
this.compte = h;
|
||||
}
|
||||
// méthode
|
||||
public void plusUn() {
|
||||
this.compte++;
|
||||
}
|
||||
// autre méthode
|
||||
public String toString() {
|
||||
return Integer.toBinaryString(this.compte);
|
||||
}
|
||||
|
||||
}
|
||||
BIN
APL2.1/TP4/Progression/Progression.class
Normal file
BIN
APL2.1/TP4/Progression/Progression.class
Normal file
Binary file not shown.
9
APL2.1/TP4/Progression/Progression.java
Normal file
9
APL2.1/TP4/Progression/Progression.java
Normal file
@@ -0,0 +1,9 @@
|
||||
public class Progression {
|
||||
public static void main(String[] args) {
|
||||
Compteur c = new Compteur(5);
|
||||
for (int i=0;i<5;i++){
|
||||
System.out.println(c);
|
||||
c.plusUn();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user