Class Student


public class Student extends Object
Represents a student who can rent spell books. Each student is assigned a unique ID and maintains a record of current and past rentals.
  • Constructor Details

    • Student

      public Student(String name)
      Constructs a new Student with a unique student ID and the given name.
      Parameters:
      name - the name of the student
  • Method Details

    • getNumber

      public int getNumber()
    • getName

      public String getName()
    • getCurrentSpellbooks

      public List<Integer> getCurrentSpellbooks()
    • getHistory

      public List<Integer> getHistory()
    • setName

      public void setName(String name)
    • addToCurrentSpellbooks

      public void addToCurrentSpellbooks(int serialNumber)
      Adds a spellbook to the list of currently rented books.
      Parameters:
      serialNumber - the serial number of the spell book
    • addToHistory

      public void addToHistory(int serialNumber)
      Adds a spell book to the rental history.
      Parameters:
      serialNumber - the serial number of the spell book
    • clearCurrentSpellbooks

      public void clearCurrentSpellbooks()
    • removeSpellbook

      public void removeSpellbook(int serialNumber)
      Removes a spell book from the list of currently rented books.
      Parameters:
      serialNumber - the serial number of the spell book to remove
    • resetStudentId

      public static void resetStudentId()
      Resets the student ID counter to its initial value between testcases.