diff options
| author | Gaspard Coulet <gaspard.coulet@mines-ales.org> | 2021-04-28 23:05:53 +0200 |
|---|---|---|
| committer | Gaspard Coulet <gaspard.coulet@mines-ales.org> | 2021-04-28 23:05:53 +0200 |
| commit | 9fe033ea88c2f705ec18c232873d056e0c229d72 (patch) | |
| tree | 0647dc8c51610c7336c88c04de2068ea14b21e17 /sem_4/java/eclipse-workspace/Cours406/src/tp2/Etudiant.java | |
Initial commit
Diffstat (limited to 'sem_4/java/eclipse-workspace/Cours406/src/tp2/Etudiant.java')
| -rw-r--r-- | sem_4/java/eclipse-workspace/Cours406/src/tp2/Etudiant.java | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/sem_4/java/eclipse-workspace/Cours406/src/tp2/Etudiant.java b/sem_4/java/eclipse-workspace/Cours406/src/tp2/Etudiant.java new file mode 100644 index 0000000..ca78a4b --- /dev/null +++ b/sem_4/java/eclipse-workspace/Cours406/src/tp2/Etudiant.java @@ -0,0 +1,118 @@ +package tp2;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.text.DateFormat;
+import java.text.ParseException;
+
+public class Etudiant {
+ private String nom;
+ private Date birthdate;
+ private int codeIns;
+ private int codePays;
+ private double note1;
+ private double note2;
+ private double note3;
+ public Etudiant() {
+ nom = "None";
+ }
+ public String getNom() {
+ return nom;
+ }
+ public void setNom(String nom) {
+ this.nom = nom;
+ }
+// public int getAge() throws ParseException {
+// return 2018-;
+// }
+ public Date getBirthYear() {
+ return birthdate;
+ }
+ public void setBirthyear(Date birthyear) {
+ this.birthdate = birthyear;
+ }
+ public int getCodeIns() {
+ return codeIns;
+ }
+ public void setCodeIns(int codeIns) {
+ this.codeIns = codeIns;
+ }
+ public int getCodePays() {
+ return codePays;
+ }
+ public void setCodePays(int codePays) {
+ this.codePays = codePays;
+ }
+ public double getNote1() {
+ return note1;
+ }
+ public void setNote1(double note1) {
+ this.note1 = note1;
+ }
+ public double getNote2() {
+ return note2;
+ }
+ public void setNote2(double note2) {
+ this.note2 = note2;
+ }
+ public double getNote3() {
+ return note3;
+ }
+ public void setNote3(double note3) {
+ this.note3 = note3;
+ }
+ public Etudiant(String name, /*Date birthyear,*/ int codeIns, int codePays, double note1, double note2, double note3) {
+ super();
+ this.nom=name;
+// this.birthdate = birthyear;
+ this.codeIns = codeIns;
+ this.codePays = codePays;
+ this.note1 = note1;
+ this.note2 = note2;
+ this.note3 = note3;
+ }
+ public double getMoy() {
+ return (note1+note2+note3)/3;
+ }
+ public String getMention() {
+ double moy = getMoy();
+ if ( moy > 10) {
+ if (moy < 12) {
+ return "Admis";
+ }
+ else if (moy < 14) {
+ return "Assez bien";
+ }
+ else if (moy < 16) {
+ return "Bien";
+ }
+ else {
+ return "Très bien";
+ }
+ }
+ else {
+ return "Ajourné";
+ }
+ }
+ public void ligneResultats (){
+ String tmp = getMention();
+ String ret = getNom()+" "+ getBirthYear()+" "+(int)(getMoy()*100)/100.+" "+tmp+" ";
+ if (tmp.equals("Ajourné")) {
+ if ( note1>=10 ) {
+ ret+="module 1 acquis ";
+ }
+ if ( note2>=10 ) {
+ ret+="module 2 acquis ";
+ }
+ if ( note3>=10 ) {
+ ret+="module 3 acquis ";
+ }
+ }
+ System.out.println(ret);
+ }
+ public String toString() {
+ String ret = "Nom : "+getNom()+"\n"+/*"Age : "+getAge()+"\n"+*/"Année de naissance : "+getBirthYear()+"\n"+"Premiere inscription ? " +(getCodeIns()==0?"Oui":"Non")+"\n"+ "Nationalité : "+ (getCodePays()==0? "Francaise": (getCodePays()==1? "Autre francophone":"Autre non-francophone"))+ "\n"+"Notes : "+ (int)(getNote1()*100)/100.+" "+ (int)(getNote2()*100)/100.+" "+(int)(getNote3()*100)/100.+"\n"+"Moyenne : "+(int)(getMoy()*100)/100.+" "+getMention()+"\n";
+ return ret;
+ }
+}
+
|
