Package beispiel

Class Student

java.lang.Object
beispiel.Student

public class Student
extends java.lang.Object
This is the class Student. It represents a Student with a name, birthdate and unique matnr.
  • Constructor Summary

    Constructors 
    Constructor Description
    Student​(int matnr, java.lang.String name, java.time.LocalDate birthdate)
    Creates a new Student object.
  • Method Summary

    Modifier and Type Method Description
    boolean equals​(java.lang.Object o)  
    java.time.LocalDate getBirthdate()
    Returns the birthdate of the student
    int getMatnr()
    Returns the matnr of the Student.
    java.lang.String getName()
    Returns the name of the student as a single String (first and last name)
    int hashCode()  
    void joinCourse​(Course course)
    Adds the Course to the Student's course list
    void leaveCourse​(Course course)
    Removes a Course from the Student's course list
    void setBirthdate​(java.time.LocalDate birthdate)
    Sets the birthdate of the student
    void setName​(java.lang.String name)
    Sets the name of the student as a single String (first and last name)

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Student

      public Student​(int matnr, java.lang.String name, java.time.LocalDate birthdate)
      Creates a new Student object. After the matnr. is set, it cannot be changed later on. Each student must be created with a unique matnr.
      Parameters:
      matnr - The unique matnr. of the Student
      name - The name of the Student
      birthdate - The birthdate of the Student
  • Method Details

    • getMatnr

      public int getMatnr()
      Returns the matnr of the Student. Each student has a unique matnr.
      Returns:
      The matnr of the Student
    • getName

      public java.lang.String getName()
      Returns the name of the student as a single String (first and last name)
      Returns:
      The first and last name of the Student a a single String
    • setName

      public void setName​(java.lang.String name)
      Sets the name of the student as a single String (first and last name)
      Parameters:
      name - The first and last name of the Student a a single String
    • getBirthdate

      public java.time.LocalDate getBirthdate()
      Returns the birthdate of the student
      Returns:
      The birthdate of the student
    • setBirthdate

      public void setBirthdate​(java.time.LocalDate birthdate)
      Sets the birthdate of the student
      Parameters:
      birthdate - The birthdate of the student
    • joinCourse

      public void joinCourse​(Course course)
      Adds the Course to the Student's course list
      Parameters:
      course - The course to add
    • leaveCourse

      public void leaveCourse​(Course course)
      Removes a Course from the Student's course list
      Parameters:
      course - The course to leave
    • 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