Package beispiel

Class Course

java.lang.Object
beispiel.Course

public class Course
extends java.lang.Object
This is the class Course. It represents a course that a Student can enroll in. Each Course has a unique id, a name and a certain amount of ECTS.
  • Constructor Summary

    Constructors 
    Constructor Description
    Course​(int id, java.lang.String name, int ects)
    Creates a new Cousre object.
  • Method Summary

    Modifier and Type Method Description
    boolean equals​(java.lang.Object o)
    Checks if the given Object o is equal to this object
    int getEcts()
    Returns the ECTS of the Course
    int getId()
    Returns the unique id of the Course
    java.lang.String getName()
    Returns the name of the Course
    int hashCode()  
    void setEcts​(int ects)
    Sets the ECTS of the Course
    void setName​(java.lang.String name)
    Sets the name of the Course

    Methods inherited from class java.lang.Object

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

    • Course

      public Course​(int id, java.lang.String name, int ects)
      Creates a new Cousre object. After the id is set, it cannot be changed later on. Each Course must be created with a unique id
      Parameters:
      id - The unique id of the Course
      name - The name of the Course
      ects - The amount of ects the Course gives
  • Method Details

    • getId

      public int getId()
      Returns the unique id of the Course
      Returns:
      The unique id of the Course
    • getName

      public java.lang.String getName()
      Returns the name of the Course
      Returns:
      The name of the Course
    • setName

      public void setName​(java.lang.String name)
      Sets the name of the Course
      Parameters:
      name - The name of the Course
    • getEcts

      public int getEcts()
      Returns the ECTS of the Course
      Returns:
      The ECTS of the Course
    • setEcts

      public void setEcts​(int ects)
      Sets the ECTS of the Course
      Parameters:
      ects - The ECTS of the Course
    • equals

      public boolean equals​(java.lang.Object o)
      Checks if the given Object o is equal to this object
      Overrides:
      equals in class java.lang.Object
      Parameters:
      o - The Object to compare to this object
      Returns:
      Returns true, if the given object is a Course object which has the same id as this object, false otherwise
    • hashCode

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