Skip to content
Snippets Groups Projects
Commit 8622076c authored by SEYE El hadji babou's avatar SEYE El hadji babou
Browse files

Modification de la méthode getValue,toString et averageGrade de la classe Grade

parent b9bfe82c
No related branches found
No related tags found
No related merge requests found
......@@ -28,6 +28,7 @@ public class Grade {
*/
public double getValue() {
return value ;
}
/**
......@@ -36,6 +37,9 @@ public class Grade {
*/
@Override
public String toString() {
String str = new String();
str = str.valueOf(value) ;
return str + "/20" ;
}
/**
......@@ -46,6 +50,11 @@ public class Grade {
* @return a grade corresponding to the mean of grade in {@code grades}
*/
public static Grade averageGrade(List<Grade> grades){
double result = 0 ;
for (Grade grade : grades) {
result = result + grade.value;
}
return new Grade(result / grades.size());
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment