type.lib
Class CEstudent

java.lang.Object
  extended by type.lib.Student
      extended by type.lib.CEstudent
All Implemented Interfaces:
java.io.Serializable, java.lang.Iterable<java.lang.String>

public class CEstudent
extends Student

Provide services to maintain information about a CE (computer engineering) student. The class encapsulates the same information and functionality as COSCstudent except for two differences: the ID is auto-assigned serially (starting from 200102001 and ending at 200102999), and there is no 'E' grade. In addition, the return of the toString method is prefixed by "CE".

Version:
7.0 - Summer 2010
Author:
H. Roumani, roumani@cse.yorku.ca
See Also:
Serialized Form

Field Summary
 
Fields inherited from class type.lib.Student
rng
 
Constructor Summary
CEstudent(java.lang.String name)
          Create a CE student having the given name, and assigns it a serial 3-digit ID prefixed by "200102" and an empty (fresh) record.
 
Method Summary
 boolean setCourseGrade(java.lang.String course, java.lang.String grade)
          Update the student's record in exactly the same manner as in the COSCstudent class except that no 'E' grade is allowed.
 java.lang.String toString()
          Return a string representation of this student.
 
Methods inherited from class type.lib.Student
equals, getCourseGrade, getFirstCourse, getGpa, getID, getName, getNextCourse, getRandom, getRandom, hashCode, iterator, setSeed
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CEstudent

public CEstudent(java.lang.String name)
Create a CE student having the given name, and assigns it a serial 3-digit ID prefixed by "200102" and an empty (fresh) record.

Parameters:
name - the name of the CE student.
Method Detail

setCourseGrade

public boolean setCourseGrade(java.lang.String course,
                              java.lang.String grade)
Update the student's record in exactly the same manner as in the COSCstudent class except that no 'E' grade is allowed.

Overrides:
setCourseGrade in class Student
Parameters:
course - the course the student took
grade - the achieved grade in that course
Returns:
true if the record was updated as requested and return false otherwise. The record will not be updated if the given course number is not made up of exactly 4 digits or if the given letter grade is not one of the letters (A,B,C,D,E,F) in capital or small-case.

toString

public java.lang.String toString()
Return a string representation of this student.

Overrides:
toString in class Student
Returns:
the string "CE student: " followed by the student's name.


Java by Abstraction: A Client-View Approach