Controle machine

This commit is contained in:
Simoes Lukas
2025-03-19 10:18:41 +01:00
parent 42cc204dea
commit 376861b608
86 changed files with 803 additions and 179 deletions

View File

@@ -0,0 +1,16 @@
import java.awt.*;
import java.util.Random;
public class Exquis {
private String[] chaines;
public Exquis(String[] chaines) {
this.chaines = chaines;
}
public String toString() {
Random aleatoire = new Random();
return this.chaines[Math.abs(aleatoire.nextInt()) % this.chaines.length];
}
}

View File

@@ -0,0 +1,35 @@
public class Main {
public static void main(String[] args) {
String[] sujets = {
"Luc",
"Denis",
"Régine",
"Selma",
"Frédéric"
};
String[] verbes = {
"aime",
"déteste",
"tue",
"mange",
"épouse"
};
String[] complements = {
"Windows",
"les pommes",
"Elizabeth II",
"les batyscaphes" // Je sais même pas si c'est un nom commun en vrai
};
Exquis sujet = new Exquis(sujets);
Exquis verbe = new Exquis(verbes);
Exquis complement = new Exquis(complements);
for (int i = 0; i != 5; i++) {
System.out.println(sujet + " " + verbe + " " + complement);
}
}
}