import [Link].
ArrayList;
import [Link];
class Joueur {
private String nom;
private int age;
private String pays;
private String club;
private double poids;
private double taille;
private String poste;
private int numero;
// Constructeur
public Joueur(String nom, int age, String pays, String club, double poids, double taille, String
poste, int numero) {
[Link] = nom;
[Link] = age;
[Link] = pays;
[Link] = club;
[Link] = poids;
[Link] = taille;
[Link] = poste;
[Link] = numero;
}
// Méthode pour véri er si le nom correspond
public boolean correspondNom(String nom) {
return [Link](nom);
}
// Méthode pour a cher les informations
public void a cherInformations() {
[Link]("Nom : " + nom);
[Link]("Âge : " + age + " ans");
[Link]("Pays : " + pays);
[Link]("Club : " + club);
[Link]("Poids : " + poids + " kg");
[Link]("Taille : " + taille + " m");
[Link]("Poste : " + poste);
[Link]("Numéro : " + numero);
}
}
public class Main {
public static void main(String[] args) {
// Liste des joueurs
ArrayList<Joueur> joueurs = new ArrayList<>();
[Link](new Joueur("Lionel Messi", 36, "Argentine", "Inter Miami", 70, 1.70, "Attaquant",
10));
[Link](new Joueur("Cristiano Ronaldo", 39, "Portugal", "Al-Nassr", 85, 1.87,
"Attaquant", 7));
[Link](new Joueur("Kylian Mbappé", 25, "France", "Paris Saint-Germain", 75, 1.78,
"Attaquant", 7));
// Saisie du nom par l'utilisateur
Scanner scanner = new Scanner([Link]);
[Link]("Entrez le nom du joueur : ");
String nomRecherche = [Link]();
ffi
ffi
fi
// Appel de la fonction pour a cher les informations
a cherInformationsJoueur(joueurs, nomRecherche);
[Link]();
}
// Fonction pour a cher les informations d'un joueur
public static void a cherInformationsJoueur(ArrayList<Joueur> joueurs, String nom) {
boolean joueurTrouve = false;
for (Joueur joueur : joueurs) {
if ([Link](nom)) {
joueur.a cherInformations();
joueurTrouve = true;
break;
}
}
// Si le joueur n'est pas trouvé
if (!joueurTrouve) {
[Link]("Désolé, le joueur '" + nom + "' n'a pas été trouvé.");
}
}
}
ffi
ffi
ffi
ffi
ffi