Class Department

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

public class Department extends Object
Represents a department in a college course catalog. Each department has a unique ID and a name.
  • Constructor Details

    • Department

      public Department(int id, String name)
      Creates a new Department with the specified ID and name.
      Parameters:
      id - the unique identifier for the department
      name - the name of the department
    • Department

      public Department(String name)
      Creates a new Department with the specified name. The ID will be auto-generated when the department is saved to the database.
      Parameters:
      name - the name of the department
    • Department

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

    • getId

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

      public void setId(int id)
      Sets the ID of this department.
      Parameters:
      id - the department ID
    • getName

      public String getName()
      Returns the name of this department.
      Returns:
      the department name
    • setName

      public void setName(String name)
      Sets the name of this department.
      Parameters:
      name - the department name
    • 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