Class Student
- java.lang.Object
-
- Student
-
public class Student extends java.lang.ObjectA 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 voidaddResult(java.lang.String teachingUnitName, Grade grade)Add a grade associated to a teaching unit to the results of the student.booleanequals(java.lang.Object o)GradegetAverageGrade()Returns the average grade of the student.java.util.List<Grade>getGrades()Returns the grades of the student.inthashCode()voidprintResults()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.StringtoString()Returns a string representation of the student in the format first name last name.
-
-
-
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 studentlastName- 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 resultgrade- 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:
toStringin classjava.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:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.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.
-
-