Package at.jku.ssw.fp.sect04_2.imp
Class Results
- java.lang.Object
-
- at.jku.ssw.fp.sect04_2.imp.Results
-
public class Results extends Object
Class representing the results of a student.- Author:
- Herbert Praehofer
-
-
Field Summary
Fields Modifier and Type Field Description private String
id
The student idprivate static int
MAX_SCORE
Maximum points for an assignmentprivate static int
N
Number of assignmentsprivate String
name
The name of the studentprivate int[]
scores
The array of scores for the different assignments
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
avrgScores()
Computes the average of the scores.int
countSolved()
Counts the assignments which are solved.Grade
getGrade()
Computes the grade from the scores.String
getName()
Returns the name of the student.int
getScore(int assignment)
Returns the score of an assignmentint[]
getScores()
Returns the array of the scores for theN
assignments.String
getStdId()
Returns the id of the student.void
setScore(int assignment, int score)
Sets the score of an assignment.void
setScores(int... scores)
Sets the scores for theN
assignments.
-
-
-
Field Detail
-
N
private static final int N
Number of assignments- See Also:
- Constant Field Values
-
MAX_SCORE
private static final int MAX_SCORE
Maximum points for an assignment- See Also:
- Constant Field Values
-
id
private final String id
The student id
-
name
private final String name
The name of the student
-
scores
private final int[] scores
The array of scores for the different assignments
-
-
Method Detail
-
getStdId
public String getStdId()
Returns the id of the student.- Returns:
- the id of the student
-
getName
public String getName()
Returns the name of the student.- Returns:
- the name of the student
-
getScore
public int getScore(int assignment)
Returns the score of an assignment- Parameters:
assignment
- the number of the assignment.- Returns:
- the score of the assignment
-
getScores
public int[] getScores()
Returns the array of the scores for theN
assignments.- Returns:
- the array of the scores
-
setScore
public void setScore(int assignment, int score)
Sets the score of an assignment.- Parameters:
assignment
- the number of the assignmentscore
- the score for the assignment
-
setScores
public void setScores(int... scores)
Sets the scores for theN
assignments.- Parameters:
scores
- the array with the scores
-
countSolved
public int countSolved()
Counts the assignments which are solved. An assignment is solved if 40% of the points have been achieved.- Returns:
- the number of solved assignments
-
avrgScores
public double avrgScores()
Computes the average of the scores.- Returns:
- the average of the scores
-
getGrade
public Grade getGrade()
Computes the grade from the scores.- Returns:
- the grade
-
-