Class ClassPeriod

java.lang.Object
  extended by ClassPeriod

public class ClassPeriod
extends Object

ClassPeriod represents a class period which has a teacher, a period number, and an array of students (max 35)


Constructor Summary
ClassPeriod()
          No-argument constructor.
ClassPeriod(String name)
          Constructor that takes just the teacher's name
ClassPeriod(String name, int num)
          Constructor that takes the teacher's name and period number
 
Method Summary
 int getNumStudents()
          Method to return the number of students in the period
 int getPeriodNumber()
          Method to get the period number
 Student getStudent(int index)
          Method to get a student based on the index
 String getTeacherName()
          Method to get the teacher's name
static void main(String[] args)
          Main method
 boolean setPeriodNumber(int num)
          Method to set the period number (if it hasn't been set)
 void setStudent(Student studentObj, int index)
          Method to set the student at an index
 void setTeacherName(String name)
          Method to set the teacher's name
 String toString()
          Method to return a string of information about this class period
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClassPeriod

public ClassPeriod()
No-argument constructor. Leaves field values alone


ClassPeriod

public ClassPeriod(String name)
Constructor that takes just the teacher's name

Parameters:
name - the name for the teacher

ClassPeriod

public ClassPeriod(String name,
                   int num)
Constructor that takes the teacher's name and period number

Parameters:
name - the name for the teacher
num - the period number
Method Detail

getTeacherName

public String getTeacherName()
Method to get the teacher's name

Returns:
the name of the teacher, or null if none yet

getPeriodNumber

public int getPeriodNumber()
Method to get the period number

Returns:
the number for this period

getStudent

public Student getStudent(int index)
Method to get a student based on the index

Returns:
the student at this index

setTeacherName

public void setTeacherName(String name)
Method to set the teacher's name

Parameters:
name - the name to use

setPeriodNumber

public boolean setPeriodNumber(int num)
Method to set the period number (if it hasn't been set)

Parameters:
num - the number to use
Returns:
flag to say if set worked

setStudent

public void setStudent(Student studentObj,
                       int index)
Method to set the student at an index

Parameters:
studentObj - the student object to use
index - the index to set the student at

getNumStudents

public int getNumStudents()
Method to return the number of students in the period

Returns:
the number of students in the period

toString

public String toString()
Method to return a string of information about this class period

Overrides:
toString in class Object
Returns:
information about the class period

main

public static void main(String[] args)
Main method

Parameters:
args - the arguments to execution