Salut
attention, rien n'a été compilé !!!!!
public class Etudiant {
private String name;
private String surname;
private String age;
private Bulletin myCurrentBulletin;
private static Vector myBulletins;
public Etudiant(String name, String surname, String age, String year) {
this.name = name;
this.surname = surname;
this.age = age;
myCurrentBulletin = new Bulletin(year);
this.getMyBulletins.add(myCurrentBulletin);
}
public static Vector getMyBulletins() {
if ( myBulletins == null )
myBulletins = new Vector();
return myBulletins;
}
public String getInfo(){
return "Nom: " + this.name + ", " + "Prénom: " + this.surname + ", " + "Age: " + this.age + "." ;
}
public String getName(){
return this.name;
}
public String getSurname(){
return this.surname;
}
public String getAge(){
return this.age;
}
public Bulletin getCurrentBulletin(){
return this.myCurrentBulletin;
}
public Bulletin getOneBulletin(String year){
Bulletin tempo;
Iterator rator = myBulletins.iterator
for (rator.hasNext()){
tempo = (Bulletin) rator.next();
if (tempo.getYear == year){
return tempo
}
}
}
public void setName(String name){
this.name = name;
}
public void setSurname(String surname){
this.surname = surname;
}
public void setAge(String age){
this.age = age;
}
}
public class LaClasse {
private static Vector etudiants;
private String name;
public LaClasse(String name){
this.name = name;
}
public static Vector getEtudiants() {
if ( etudiants == null )
etudiants = new Vector();
return etudiants;
}
public void addNewEtudiant( Etudiant new){
this.getEtudiants().add(new);
}
public Etudiant getOneEtudiant(String name, String surname){
// a implémenter !!!
}
}
public class Bulletin {
private TreeMap resultats;
private String year;
public Bulletin (String year){
this.year = year;
resultats = new TreeMap();
resultats.put( "Math", new Float( 0 ) );
...................................... // ajouter les matière voulues avec la valeur de départ
}
public String getYear(){
return this.year;
}
// voilà reste plus qu'a créer les différentes méthodes pour récupérer les points, les moyennes etc, pour jongler avec le TreeMap
http://java.sun.com/j2se/1.3/docs/api/java/util/TreeMap.html
}
// Il reste à créer la classe principale pour faire fonctionner tout le bazar, mais là je te laisse faire
Chouba,
Pochard d'assaut ..