This commit is contained in:
2022-12-08 11:00:41 +01:00
parent 85717c2de7
commit 672cba6c35
88 changed files with 15381 additions and 0 deletions

View File

@@ -0,0 +1,74 @@
package fr.iutfbleau.projetIHM2022FI2.MP;
import fr.iutfbleau.projetIHM2022FI2.API.*;
import java.util.*;
/**
* Un étudiant
*/
public class EtudiantNP implements Etudiant{
// auto-incrément des étudiants
private static int nextId=0;
// id de l'étudiant
private int id;
// nom et prénom de l'étudiant
private String nom, prenom;
/**
* Constructeur d'un étudiant.
* @param nom le nom de l'étudiant
* @param prenom le prénom de l'étudiant
*
*/
public EtudiantNP(String nom, String prenom){
Objects.requireNonNull(nom,"On ne peut pas créer un étudiant avec un nom null");
Objects.requireNonNull(prenom,"On ne peut pas créer un étudiant avec un nom null");
// auto incrément de l'id
this.id=++this.nextId;
this.nom=nom;
this.prenom=prenom;
}
/**
* Constructeur d'un étudiant.
* @param nom le nom de l'étudiant
* @param prenom le prénom de l'étudiant
* @param id l'id de l'étudiant
*/
public EtudiantNP(String nom, String prenom, int id){
Objects.requireNonNull(nom,"On ne peut pas créer un étudiant avec un nom null");
Objects.requireNonNull(prenom,"On ne peut pas créer un étudiant avec un nom null");
if(id>=this.nextId){
this.nextId=id;
}
this.id=id;
this.nom=nom;
this.prenom=prenom;
}
/**
* permet de récupérer l'identifiant de l'étudiant.
* @return l'identifiant.
*/
public int getId(){
return this.id;
}
/**
* permet de récupérer
* @return le nom de l'étudiant.
*/
public String getNom(){
return this.nom;
}
/**
* permet de récupérer
* @return le prénom de l'étudiant
*/
public String getPrenom(){
return this.prenom;
}
}