public class Client {
// ── Attributs privés (encapsulation) ──
private int id;
private String nom;
private String prenom;
private String telephone;
private String email;
private String numeroPermis;
// ── Compteur statique pour générer les identifiants automatiquement ──
private static int compteur = 0;
// ── Constructeur complet ──
public Client(String nom, String prenom, String telephone, String email, String numeroPermis) {
this.id = ++compteur;
this.nom = nom;
this.prenom = prenom;
this.telephone = telephone;
this.email = email;
this.numeroPermis = numeroPermis;
}
// ── Getters ──
public int getId() {
return id;
}
public String getNom() {
return nom;
}
public String getPrenom() {
return prenom;
}
public String getTelephone() {
return telephone;
}
public String getEmail() {
return email;
}
public String getNumeroPermis() {
return numeroPermis;
}
// ── Setters ──
public void setNom(String nom) {
this.nom = nom;
}
public void setPrenom(String prenom) {
this.prenom = prenom;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
public void setEmail(String email) {
this.email = email;
}
public void setNumeroPermis(String numeroPermis) {
this.numeroPermis = numeroPermis;
}
// ── Méthode d'affichage ──
public void afficherDetails() {
System.out.println("──────────────────────────────────");
System.out.println(" ID : " + id);
System.out.println(" Nom : " + nom);
System.out.println(" Prénom : " + prenom);
System.out.println(" Téléphone : " + telephone);
System.out.println(" Email : " + email);
System.out.println(" N° Permis : " + numeroPermis);
System.out.println("──────────────────────────────────");
}
// ── toString (pratique pour le débogage) ──
@Override
public String toString() {
return id + " | " + nom + " " + prenom + " | " + telephone + " | " + email + " | Permis: " + numeroPermis;
}
}