diff --git a/src/tp04/StudentAbs.java b/src/tp04/StudentAbs.java index 36973b1800054f054ac15fb10e950ed82ceea70a..298c358b4c2e7ba30d62ed1bd4cb492b37bb27ad 100644 --- a/src/tp04/StudentAbs.java +++ b/src/tp04/StudentAbs.java @@ -2,9 +2,36 @@ package tp04; public class StudentAbs extends Student { - public StudentAbs(Person pers, double[] grades) + private int nbAbsence; + + public StudentAbs(Student pers, double[] grades, int abs) { super(pers, grades); + this.nbAbsence=abs; + } + + public int getNbAbsence() { + return nbAbsence; + } + + public boolean warning(int thresholdAbs, double thresholdAvg) + { + return getAverage() <= thresholdAvg || getNbAbsence() >= thresholdAbs; + } + + public boolean validation(int thresholdAbs, double thresholdAvg) + { + return getAverage() >= thresholdAvg || getNbAbsence() <= thresholdAbs; } + public boolean equals(StudentAbs abs) + { + return abs.getNbAbsence() == this.getNbAbsence(); + } + + @Override + public String toString() + { + return getPers().getForename()+" "+getPers().getName()+", nbAbs="+getNbAbsence(); + } } \ No newline at end of file diff --git a/src/tp04/YearGroup.java b/src/tp04/YearGroup.java new file mode 100644 index 0000000000000000000000000000000000000000..56c93cc48023438cfb82eb22283af5e5d52a8d84 --- /dev/null +++ b/src/tp04/YearGroup.java @@ -0,0 +1,9 @@ +package tp04; + +public class YearGroup extends StudentAbs +{ + public YearGroup(Student pers, double[] grades, int abs) + { + super(pers, grades, abs); + } +} \ No newline at end of file