public abstract class Student
extends java.lang.Object
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
public Student(java.lang.String firstName, java.lang.String lastName, java.lang.String grade, int credits)
firstName
- the student's first namelastName
- the student's last namegrade
- the student's letter gradecredits
- the number of credits carried by the studentpublic void setFirstName(java.lang.String firstName)
firstName
- the student's first namepublic void setLastName(java.lang.String lastName)
lastName
- the student's last namepublic void setGrade(java.lang.String grade)
grade
- the student's letter gradepublic void setCredits(int credits)
credits
- the number of credits carried by the studentpublic java.lang.String getFirstName()
public java.lang.String getLastName()
public java.lang.String getGrade()
public int getCredits()
int
value.public abstract java.lang.String getTuitionString()
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.public java.lang.String toString()
toString
in class java.lang.Object