import java.util.Date; /** * A Prof sets midterms, posts assignments... * @author: Babak Esfandiari */ public class Prof extends java.util.Observable { private String name = null; private Date midterm= null; // a bit artifical admittedly public Prof(String aName) { super(); name = aName; } public Date getMidterm() { return midterm; } public String getName() { return name; } public void setMidterm(Date date) { midterm = date; // see why it is useful to have getters and setters! // we can now notify observers of the change setChanged(); notifyObservers(); } /** * Test... Should display "Doh!" as a result... */ public static void main(String[] args) { Prof p = new Prof("Babak"); Course c = new Course("94.204", p); Student s = new Student("Homer"); s.registerCourse(c); p.setMidterm(new Date()); } }