Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
1
1_HANOUCHE_MOHAMED_2_BLAISEKAPLANSKI_TEO
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
POUYE Alassane
1_HANOUCHE_MOHAMED_2_BLAISEKAPLANSKI_TEO
Commits
4141bdb4
Commit
4141bdb4
authored
4 years ago
by
Alexis Nasr
Browse files
Options
Downloads
Patches
Plain Diff
ajout d'un classe pour tester Grade
parent
212247b7
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tp1/Main.java
+0
-10
0 additions, 10 deletions
tp1/Main.java
tp1/TestGrade.java
+59
-0
59 additions, 0 deletions
tp1/TestGrade.java
with
59 additions
and
10 deletions
tp1/Main.java
+
0
−
10
View file @
4141bdb4
public
class
Main
{
public
static
void
main
(
String
[]
args
){
Student
student1
=
new
Student
(
"Arnaud"
,
"Labourel"
);
Student
student2
=
new
Student
(
"Paul"
,
"Calcul"
);
student1
.
addResult
(
"Programmation 2"
,
new
Grade
(
20
));
student2
.
addResult
(
"Programmation 2"
,
new
Grade
(
0
));
student1
.
addResult
(
"Structures discrètes"
,
new
Grade
(
20
));
student2
.
addResult
(
"Structures discrètes"
,
new
Grade
(
0
));
Cohort
cohort
=
new
Cohort
(
"L2 informatique"
);
cohort
.
addStudent
(
student1
);
cohort
.
addStudent
(
student2
);
cohort
.
printStudentsResults
();
}
}
This diff is collapsed.
Click to expand it.
tp1/TestGrade.java
0 → 100644
+
59
−
0
View file @
4141bdb4
import
java.util.ArrayList
;
public
class
TestGrade
{
public
static
void
main
(
String
[]
args
){
TestGrade
test
=
new
TestGrade
();
if
(
test
.
testGetValue
()
==
true
)
System
.
out
.
println
(
"testGradeValue : correct"
);
else
System
.
out
.
println
(
"testGradeValue : incorrect"
);
if
(
test
.
testToString
()
==
true
)
System
.
out
.
println
(
"testToString : correct"
);
else
System
.
out
.
println
(
"testToString : incorrect"
);
if
(
test
.
testAverageGrade
()
==
true
)
System
.
out
.
println
(
"testAverageGrade : correct"
);
else
System
.
out
.
println
(
"testAverageGrade : incorrect"
);
}
public
boolean
testGetValue
(){
Grade
grade
=
new
Grade
(
12.5
);
double
val
=
grade
.
getValue
();
if
(
val
==
12.5
)
return
true
;
else
return
false
;
}
public
boolean
testToString
(){
Grade
grade
=
new
Grade
(
13.7
);
String
gradeString
=
grade
.
toString
();
if
(
gradeString
.
equals
(
"13.7/20"
))
return
true
;
else
return
false
;
}
public
boolean
testAverageGrade
(){
ArrayList
<
Grade
>
list
=
new
ArrayList
<
Grade
>();
list
.
add
(
new
Grade
(
10
));
list
.
add
(
new
Grade
(
8
));
list
.
add
(
new
Grade
(
12
));
list
.
add
(
new
Grade
(
20
));
list
.
add
(
new
Grade
(
6
));
Grade
average
=
Grade
.
averageGrade
(
list
);
if
(
average
.
getValue
()
==
11.2
)
return
true
;
else
return
false
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment