Class Results


  • public class Results
    extends Object
    Class representing the results of a student.
    Author:
    Herbert Praehofer
    • Field Detail

      • 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
    • Constructor Detail

      • Results

        public Results​(String id,
                       String name,
                       int... scores)
        Constructor initializing id, name and scores.
        Parameters:
        id - the student id
        name - the student name
        scores - the 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 the N 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 assignment
        score - the score for the assignment
      • setScores

        public void setScores​(int... scores)
        Sets the scores for the N assignments.
        Parameters:
        scores - the array with the scores
      • countScores

        public int countScores​(IntPredicate pred)
        Counts the scores fulfilling a given predicate.
        Parameters:
        pred - the predicate to test the scores
        Returns:
        the number of scores fulfilling the given predicate