Class Student


  • public class Student
    extends java.lang.Object
    A students with results.
    • Constructor Summary

      Constructors 
      Constructor Description
      Student​(java.lang.String firstName, java.lang.String lastName)
      Constructs a student with the specified first name and last name and no associated results.
    • Method Summary

      Modifier and Type Method Description
      void addResult​(java.lang.String teachingUnitName, Grade grade)
      Add a grade associated to a teaching unit to the results of the student.
      boolean equals​(java.lang.Object o)  
      Grade getAverageGrade()
      Returns the average grade of the student.
      java.util.List<Grade> getGrades()
      Returns the grades of the student.
      int hashCode()  
      void printResults()
      Print via the standard output the name of the student, all results associated to the students and the average grade of the student.
      java.lang.String toString()
      Returns a string representation of the student in the format first name last name.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • Student

        public Student​(java.lang.String firstName,
                       java.lang.String lastName)
        Constructs a student with the specified first name and last name and no associated results.
        Parameters:
        firstName - the first name of the constructed student
        lastName - the last name of the constructed student
    • Method Detail

      • addResult

        public void addResult​(java.lang.String teachingUnitName,
                              Grade grade)
        Add a grade associated to a teaching unit to the results of the student.
        Parameters:
        teachingUnitName - the name of the teaching unit of the added result
        grade - the grade of the added result
      • toString

        public java.lang.String toString()
        Returns a string representation of the student in the format first name last name.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representation of the student
      • getGrades

        public java.util.List<Grade> getGrades()
        Returns the grades of the student.
        Returns:
        the grades of the student
      • getAverageGrade

        public Grade getAverageGrade()
        Returns the average grade of the student.
        Returns:
        the average grade of the student
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • printResults

        public void printResults()
        Print via the standard output the name of the student, all results associated to the students and the average grade of the student.