Skip to content
Snippets Groups Projects
Commit 2961496e authored by SEREME Tomas's avatar SEREME Tomas
Browse files

Modidication des classes cohort

parent b9bfe82c
No related branches found
No related tags found
No related merge requests found
......@@ -24,6 +24,8 @@ public class Cohort {
* @param student the student to be added to the cohort
*/
public void addStudent(Student student){
students.add(student);
}
/**
......@@ -31,6 +33,7 @@ public class Cohort {
* @return the list of students of the cohort.
*/
public List<Student> getStudents(){
return List.copyOf (students);
}
/**
......@@ -38,9 +41,17 @@ public class Cohort {
* grade.
*/
public void printStudentsResults(){
printName();
System.out.println();
for (Student student : students){
student.printResults();
System.out.println();
}
}
private void printName(){
System.out.println(this.toString());
}
/**
......@@ -49,5 +60,6 @@ public class Cohort {
*/
@Override
public String toString() {
return name;
}
}
public class Main {
public static void main(String[] args){
Student student1 = new Student("Tomas","Sereme");
Student student2 = new Student("Zidani fahed","Imed");
student1.addResult("programmation2", new Grade(20));
student2.addResult("programmation2", new Grade(0));
student1.addResult("Structures discretes",new Grade(20));
student2.addResult("Structures discretes", new Grade(0));
Cohort cohort = new Cohort("L2 informatique");
cohort.addStudent(student1);
cohort.addStudent(student2);
cohort.printStudentsResults();
}
}
......@@ -26,6 +26,8 @@ public class TeachingUnitResult {
* @return the grade associated to the result
*/
public Grade getGrade() {
grade = teachingUnitName + grade;
return grade;
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment