/**
* @author: Babak Esfandiari
*/
class Student implements java.util.Observer {
String name = null;
Course course = null; //assuming one course for simplicity sake
public Student(String aName) {
super();
name = aName;
}
String getName() {
return name;
}
/**
* Each time a student registers a course, he/she also subscribes
* for the prof's notifications related to that course.
*/
void registerCourse(Course aCourse) {
course = aCourse;
course.getProf().addObserver(this);
}
/**
* This method is called whenever the observed object is changed. An
* application calls an Observable object's
* notifyObservers
method to have all the object's
* observers notified of the change.
*
* @param o the observable object.
* @param arg an argument passed to the notifyObservers
* method.
*/
public void update(java.util.Observable o, Object arg) {
System.out.println("Doh!");
}
}