Skip to content
Snippets Groups Projects
Commit b83aafa4 authored by Hai Dang's avatar Hai Dang
Browse files

Updated TeachingUnitResult

Implémentation des méthodes toString, equals, getGrade, et ajout d'une
class TestTeachingUnitResult
parent e93f9d5a
No related branches found
No related tags found
No related merge requests found
......@@ -26,6 +26,7 @@ public class TeachingUnitResult {
* @return the grade associated to the result
*/
public Grade getGrade() {
return this.grade;
}
/**
......@@ -34,5 +35,14 @@ public class TeachingUnitResult {
*/
@Override
public String toString() {
return this.teachingUnitName;
}
public boolean equals(Grade grade){
if (this.grade.getValue() == grade.getValue()){
return true;
}
return false;
}
}
public class TestTeachingUnitResult {
public static void main(String[] args) {
TestTeachingUnitResult test = new TestTeachingUnitResult();
if (test.TestToString()){
System.out.println("ok");
}
System.out.println(test.TestEquals());
}
public boolean TestToString(){
TeachingUnitResult teachingUnitResult = new TeachingUnitResult("programmation2", new Grade(0));
String teachingUnitResultString = teachingUnitResult.toString();
if(teachingUnitResultString == "programmation2"){
return true;
}
return false;
}
public boolean TestEquals(){
TeachingUnitResult teachingUnitResult = new TeachingUnitResult("",new Grade(15));
TeachingUnitResult teachingUnitResult1 = new TeachingUnitResult( "", new Grade(15));
if(teachingUnitResult.equals(teachingUnitResult1.getGrade()))
{
return true;
}
return false;
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment