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/Promotion.java | |
Initial commit
Diffstat (limited to 'sem_4/java/eclipse-workspace/Cours406/src/tp2/Promotion.java')
| -rw-r--r-- | sem_4/java/eclipse-workspace/Cours406/src/tp2/Promotion.java | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/sem_4/java/eclipse-workspace/Cours406/src/tp2/Promotion.java b/sem_4/java/eclipse-workspace/Cours406/src/tp2/Promotion.java new file mode 100644 index 0000000..6fe7d45 --- /dev/null +++ b/sem_4/java/eclipse-workspace/Cours406/src/tp2/Promotion.java @@ -0,0 +1,85 @@ +package tp2;
+
+import java.util.ArrayList;
+public class Promotion {
+ private ArrayList<Etudiant> listeetudiants;
+ private int annee;
+ public Promotion () {
+
+ }
+ public Promotion (int ext_annee) {
+ listeetudiants= new ArrayList<Etudiant> ();
+ annee = ext_annee;
+ }
+ public int getNbEtu() {
+ return listeetudiants.size();
+ }
+ public Etudiant getEtu(int n) {
+ return listeetudiants.get(n);
+ }
+ public void Inscrire (String name, /*Date birthyear,*/ int codeIns, int codePays, double note1, double note2, double note3) {
+ listeetudiants.add(new Etudiant(name,codeIns,codePays,note1, note2, note3));
+ }
+ public double moyenneGenerale () {
+ double totnotes =0;
+ for (int i =0; i < this.getNbEtu();i ++ ) {
+ totnotes += listeetudiants.get(i).getMoy();
+ }
+ if (getNbEtu()!=0) {
+ return totnotes/this.getNbEtu();
+ }
+ else return -1;
+ }
+ public void afficheRes () {
+ for (int i =0 ; i < this.getNbEtu();i++) {
+ listeetudiants.get(i).ligneResultats();
+ }
+ }
+ public Etudiant recherche( String name) {
+ Etudiant ret= new Etudiant();
+ for (int i =0 ; i < this.getNbEtu();i++) {
+ if ( listeetudiants.get(i).getNom() == name) {
+ ret = listeetudiants.get(i);
+ }
+
+ }
+ return ret;
+ }
+ public ArrayList<Etudiant> admis () {
+ ArrayList<Etudiant> ret = new ArrayList<Etudiant>();
+ for ( int i =0; i < this.getNbEtu(); i ++) {
+ if ( listeetudiants.get(i).getMoy()>=10) {
+ ret.add(listeetudiants.get(i));
+ }
+ }
+ return ret;
+ }
+ public ArrayList<Etudiant> nouveauxInscritsNonFrancophones() {
+ ArrayList<Etudiant> ret = new ArrayList<Etudiant>();
+ for ( int i =0; i < this.getNbEtu(); i ++) {
+ if ( listeetudiants.get(i).getCodeIns()==0) {
+ if ( listeetudiants.get(i).getCodePays()==2) {
+ ret.add(listeetudiants.get(i));
+ }
+ }
+ }
+ return ret;
+ }
+ public ArrayList<Etudiant> majors() {
+ ArrayList<Etudiant> ret = new ArrayList<Etudiant>();
+ double maxmoy = 0;
+ for (int i =0; i < this.getNbEtu();i++) {
+ if ( listeetudiants.get(i).getMoy() > maxmoy) {
+ maxmoy = listeetudiants.get(i).getMoy();
+ }
+ }
+ for (int i =0; i < this.getNbEtu();i++) {
+ if ( listeetudiants.get(i).getMoy() == maxmoy) {
+ ret.add(listeetudiants.get(i));
+ }
+ }
+ return ret;
+
+
+ }
+}
|
