TP iostream

This commit is contained in:
2023-04-27 11:24:21 +02:00
parent 371c3aea80
commit d934da10c1
15 changed files with 293 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,5 @@
public interface ObjetAleatoire
{
void lancer();
int lire();
}

Binary file not shown.

View File

@@ -0,0 +1,25 @@
import java.util.Random;
public class Piece implements ObjetAleatoire
{
Random rnd = new Random(System.currentTimeMillis());
private int pof;
public void lancer()
{
this.pof = rnd.nextInt(2);
}
public int lire()
{
return this.pof;
}
public static void main(String[] args) {
Piece test = new Piece();
test.lancer();
System.out.println(test.lire());
}
}