* The class Course represents a university course. There are special courses like Webinar which are
* represented in subclasses.
* @author mad
*
*/
publicclassCourse{
privateStringname;
privateintid;
publicCourse(Stringname,intid){
this.name=name;
this.id=id;
}
publicStringgetName(){
returnname;
}
publicintgetId(){
returnid;
}
/**
* Method to book course by an Attendee. As Attendee is only an interface it could actually be a student or an alumni. But this fact is not known by
* the class Course. This is good because this way also other classes could implement interface Attendee without a having to change the code of class Course.
* @param attendee
*/
publicvoidbook(Attendeeattendee){
System.out.println("The attendee <"+attendee.getName()+"> is booked for the course <"+getName()+">");
}
/**
* Overrides the toString method of the root superclass Object.
* Returns a concatenated string containing the values of the member variables.
* Is automatically called when a reference variable is used in a System.out.println method.