Class Course

java.lang.Object
edu.pdx.cs.joy.jdbc.Course

public class Course extends Object
Represents a course in a college course catalog. Each course has a unique ID, a title, is associated with a department, and has a number of credits.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new Course with no initial values.
    Course(String title, int departmentId, int credits)
    Creates a new Course with the specified title, department ID, and credits.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    int
    Returns the number of credits for this course.
    int
    Returns the department ID for this course.
    int
    Returns the unique ID of this course.
    Returns the title of this course.
    int
     
    void
    setCredits(int credits)
    Sets the number of credits for this course.
    void
    setDepartmentId(int departmentId)
    Sets the department ID for this course.
    void
    setId(int id)
    Sets the unique ID of this course.
    void
    Sets the title of this course.
     

    Methods inherited from class java.lang.Object

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

    • Course

      public Course(String title, int departmentId, int credits)
      Creates a new Course with the specified title, department ID, and credits.
      Parameters:
      title - the title of the course
      departmentId - the numeric ID of the department offering this course
      credits - the number of credits for this course
    • Course

      public Course()
      Creates a new Course with no initial values. Useful for frameworks that use reflection.
  • Method Details

    • getId

      public int getId()
      Returns the unique ID of this course.
      Returns:
      the course ID
    • setId

      public void setId(int id)
      Sets the unique ID of this course.
      Parameters:
      id - the course ID
    • getTitle

      public String getTitle()
      Returns the title of this course.
      Returns:
      the course title
    • setTitle

      public void setTitle(String title)
      Sets the title of this course.
      Parameters:
      title - the course title
    • getDepartmentId

      public int getDepartmentId()
      Returns the department ID for this course.
      Returns:
      the department ID
    • setDepartmentId

      public void setDepartmentId(int departmentId)
      Sets the department ID for this course.
      Parameters:
      departmentId - the department ID
    • getCredits

      public int getCredits()
      Returns the number of credits for this course.
      Returns:
      the number of credits
    • setCredits

      public void setCredits(int credits)
      Sets the number of credits for this course.
      Parameters:
      credits - the number of credits
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object