summaryrefslogtreecommitdiff
path: root/sem_4/java/eclipse-workspace/Cours406/src/tp2/Promotion.java
diff options
context:
space:
mode:
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.java85
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;
+
+
+ }
+}