Class Student
java.lang.Object
Student
A students with results.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a grade associated to a teaching unit to the results of the student.Returns the average grade of the student.boolean
Determines whether or not two students are equal.Returns the grades of the student.int
hashCode()
Returns a hash code value for the object.void
Print via the standard output the name of the student, all results associated to the students and the average grade of the student.toString()
Returns a string representation of the student in the format first name last name.
-
Constructor Details
-
Student
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 Details
-
addResult
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
Returns a string representation of the student in the format first name last name. -
getGrades
Returns the grades of the student.- Returns:
- the grades of the student
-
averageGrade
Returns the average grade of the student.- Returns:
- the average grade of the student
-
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. -
equals
Determines whether or not two students are equal. Two instances of Student are equal if the values of theirfirtName
andlastName
member fields are the same. -
hashCode
public int hashCode()Returns a hash code value for the object.
-