Class Student

java.lang.Object
  extended by Student
All Implemented Interfaces:
java.io.Serializable

public abstract class Student
extends java.lang.Object
implements java.io.Serializable

The Student class definition which manages student first name, last name, grade and credits fields.

Version:
Copyright 2001 (c) SCCC West
Author:
Carl B. Struck
See Also:
Serialized Form

Constructor Summary
Student()
          Constructor sets default values for student first name, last name, grade and credits fields.
Student(java.lang.String firstName, java.lang.String lastName, java.lang.String grade, int credits)
          Constructor sets initial values for student first name, last name, grade and credits fields.
 
Method Summary
 int getCredits()
          Returns the student's credits field as an int value.
 java.lang.String getFirstName()
          Returns the student's first name field as a String
 java.lang.String getGrade()
          Returns the student's grade field as a String, either A, B+, B, C+, C, D+, D or F.
 java.lang.String getLastName()
          Returns the student's last name field as a String
abstract  java.lang.String getTuitionString()
          An abstract placeholder method for the getTuitionString() method which assures that all subclasses of class Student must implement this method which is called from the toString() method of this Student class.
 void setCredits(int credits)
          Sets value for the student's credits field which must not be negative.
 void setFirstName(java.lang.String firstName)
          Sets value for student first name field.
 void setGrade(java.lang.String grade)
          Sets value for student grade field which must be from the list A, B+, B, C+, C, D+, D or F.
 void setLastName(java.lang.String lastName)
          Sets value for student last name field.
 java.lang.String toString()
          Returns a String representation of the Student class which is the formatted first name, last name, grade and credits fields with labels and the return value of the getTuitionString() method of all its subclasses.
 
Methods inherited from class
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Student

public Student()
Constructor sets default values for student first name, last name, grade and credits fields.


Student

public Student(java.lang.String firstName,
               java.lang.String lastName,
               java.lang.String grade,
               int credits)
Constructor sets initial values for student first name, last name, grade and credits fields.

Parameters:
firstName - the student's first name
lastName - the student's last name
grade - the student's letter grade
credits - the number of credits carried by the student
Method Detail

getCredits

public int getCredits()
Returns the student's credits field as an int value.

Returns:
student's number of credits carried

getFirstName

public java.lang.String getFirstName()
Returns the student's first name field as a String

Returns:
student's first name

getGrade

public java.lang.String getGrade()
Returns the student's grade field as a String, either A, B+, B, C+, C, D+, D or F.

Returns:
student's letter grade

getLastName

public java.lang.String getLastName()
Returns the student's last name field as a String

Returns:
student's last name

getTuitionString

public abstract java.lang.String getTuitionString()
An abstract placeholder method for the getTuitionString() method which assures that all subclasses of class Student must implement this method which is called from the toString() method of this Student class.


setCredits

public void setCredits(int credits)
Sets value for the student's credits field which must not be negative.

Parameters:
credits - the number of credits carried by the student

setFirstName

public void setFirstName(java.lang.String firstName)
Sets value for student first name field.

Parameters:
firstName - the student's first name

setGrade

public void setGrade(java.lang.String grade)
Sets value for student grade field which must be from the list A, B+, B, C+, C, D+, D or F.

Parameters:
grade - the student's letter grade

setLastName

public void setLastName(java.lang.String lastName)
Sets value for student last name field.

Parameters:
lastName - the student's last name

toString

public java.lang.String toString()
Returns a String representation of the Student class which is the formatted first name, last name, grade and credits fields with labels and the return value of the getTuitionString() method of all its subclasses.

Overrides:
toString in class java.lang.Object
Returns:
formatted first name, last name, grade and credits fields with labels as a String.