Modification des tests (Création de répertoire make et bake)
This commit is contained in:
36
tests/Java/test-01-from-nothing/make/Devinette.java
Normal file
36
tests/Java/test-01-from-nothing/make/Devinette.java
Normal file
@@ -0,0 +1,36 @@
|
||||
import java.util.Scanner;
|
||||
import java.util.Random;
|
||||
|
||||
public class Devinette {
|
||||
public static void main(String[] args) {
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
Random random = new Random();
|
||||
int nombreMystere = random.nextInt(100) + 1; // Nombre entre 1 et 100
|
||||
int essais = 5;
|
||||
boolean gagne = false;
|
||||
|
||||
System.out.println("Bienvenue dans le jeu de devinette !");
|
||||
System.out.println("Essayez de deviner le nombre mystère entre 1 et 100. Vous avez " + essais + " tentatives.");
|
||||
|
||||
for (int i = 0; i < essais; i++) {
|
||||
System.out.print("Entrez votre tentative : ");
|
||||
int tentative = scanner.nextInt();
|
||||
|
||||
if (tentative == nombreMystere) {
|
||||
System.out.println("Bravo ! Vous avez trouvé le nombre mystère.");
|
||||
gagne = true;
|
||||
break;
|
||||
} else if (tentative < nombreMystere) {
|
||||
System.out.println("Trop bas ! Essayez encore.");
|
||||
} else {
|
||||
System.out.println("Trop haut ! Essayez encore.");
|
||||
}
|
||||
}
|
||||
|
||||
if (!gagne) {
|
||||
System.out.println("Dommage ! Le nombre mystère était : " + nombreMystere);
|
||||
}
|
||||
|
||||
scanner.close();
|
||||
}
|
||||
}
|
6
tests/Java/test-01-from-nothing/make/test1.java
Normal file
6
tests/Java/test-01-from-nothing/make/test1.java
Normal file
@@ -0,0 +1,6 @@
|
||||
public class test1 {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Compilation à partir de rien !");
|
||||
}
|
||||
}
|
7
tests/Java/test-03-circular/make/ClasseA.java
Normal file
7
tests/Java/test-03-circular/make/ClasseA.java
Normal file
@@ -0,0 +1,7 @@
|
||||
public class ClasseA {
|
||||
private ClasseB b;
|
||||
|
||||
public ClasseA(ClasseB b) {
|
||||
this.b = b;
|
||||
}
|
||||
}
|
7
tests/Java/test-03-circular/make/ClasseB.java
Normal file
7
tests/Java/test-03-circular/make/ClasseB.java
Normal file
@@ -0,0 +1,7 @@
|
||||
public class ClasseB {
|
||||
private ClasseA a;
|
||||
|
||||
public ClasseB(ClasseA a) {
|
||||
this.a = a;
|
||||
}
|
||||
}
|
9
tests/Java/test-03-circular/make/ClasseC.java
Normal file
9
tests/Java/test-03-circular/make/ClasseC.java
Normal file
@@ -0,0 +1,9 @@
|
||||
public class ClasseC {
|
||||
private ClasseA a;
|
||||
private ClasseB b;
|
||||
|
||||
public ClasseC(ClasseA a, ClasseB b) {
|
||||
this.a = a;
|
||||
this.b = b;
|
||||
}
|
||||
}
|
16
tests/Java/test-03-circular/make/Main.java
Normal file
16
tests/Java/test-03-circular/make/Main.java
Normal file
@@ -0,0 +1,16 @@
|
||||
public class Main {
|
||||
private ClasseA a;
|
||||
private ClasseB b;
|
||||
private ClasseC c;
|
||||
|
||||
public Main() {
|
||||
this.a = new ClasseA(b);
|
||||
this.b = new ClasseB(a);
|
||||
this.c = new ClasseC(a,b);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Main m = new Main();
|
||||
System.out.println("Ceci est un test de dépendences circulaires");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user