// Path: exercises/observing-the-teacher/src/main/java/nl/han/dea/exercises/exceptions/NoAttendeesException.java
// public class NoAttendeesException extends Exception {
// }
// 
// Path: exercises/observing-the-teacher/src/main/java/nl/han/dea/exercises/exceptions/NoTeacherException.java
// public class NoTeacherException extends Exception {
// }
// 
// Path: exercises/observing-the-teacher/src/main/java/nl/han/dea/exercises/model/Course.java
// public class Course {
// 
//     Teacher teacher;
//     List<Observer> attendees;
// 
//     public Course() {
//         attendees = new ArrayList<Observer>();
//     }
// 
//     public void startCourse() throws NoTeacherException, NoAttendeesException {
//         if (teacher == null) {
//             throw new NoTeacherException();
//         } else if (attendees.isEmpty()) {
//             throw new NoAttendeesException();
//         }
//         for (Observer attendee : attendees) {
//             teacher.addObserver(attendee);
//         }
//         teacher.teach();
//     }
// 
//     public void addAttendee(Observer attendee) {
//         attendees.add(attendee);
//     }
// 
//     public void setTeacher(Teacher teacher) {
//         this.teacher = teacher;
//     }
// 
//     public void leave(Observer attendee) {
//         this.teacher.deleteObserver(attendee);
//     }
// }
// 
// Path: exercises/observing-the-teacher/src/main/java/nl/han/dea/exercises/model/Student.java
// public class Student implements Observer {
// 
//     private final String name;
//     private final Course course;
// 
//     private int numberOfNotes = 10;
// 
//     public Student(String name, Course course) {
// 
//         this.name = name;
//         this.course = course;
//     }
// 
//     private void makeNotes(String note) {
//         System.out.println("Student " + name + " made note: \n" + note);
// 
//         numberOfNotes--;
// 
//         if (numberOfNotes == 0) {
//             System.out.println("Student " + name + " has left the classroom");
//             course.leave(this);
//         }
//     }
// 
//     public void update(Observable o, Object arg) {
//         makeNotes((String) arg);
//     }
// }
// 
// Path: exercises/observing-the-teacher/src/main/java/nl/han/dea/exercises/model/Teacher.java
// public class Teacher extends Observable implements Observer{
// 
//     private final String name;
//     private Teachings teachings;
// 
//     public Teacher(String name) {
//         this.name = name;
//         this.teachings = Teachings.getInstance();
//     }
// 
//     public void teach() {
//         while (countObservers() > 0) {
// 
//             String wisdom = teachings.getWisdom();
//             say(wisdom);
//             try {
//                 Thread.sleep(1000);
//             } catch (InterruptedException e) {
//                 e.printStackTrace();
//             }
//         }
// 
//         System.out.println("Where have all my students gone?");
//     }
// 
//     private void say(String wisdom) {
//         setChanged();
//         notifyObservers(wisdom);
//     }
// 
//     public void update(Observable o, Object arg) {
//         System.out.println("hmmmm, intersting way of putting things.");
//     }
// }


import nl.han.dea.exercises.exceptions.NoAttendeesException;
import nl.han.dea.exercises.exceptions.NoTeacherException;
import nl.han.dea.exercises.model.Course;
import nl.han.dea.exercises.model.Student;
import nl.han.dea.exercises.model.Teacher;
package nl.han.dea.exercises;


public class CourseApp {
    public static void main(String[] args) {
// Path: exercises/observing-the-teacher/src/main/java/nl/han/dea/exercises/exceptions/NoAttendeesException.java
// public class NoAttendeesException extends Exception {
// }
// 
// Path: exercises/observing-the-teacher/src/main/java/nl/han/dea/exercises/exceptions/NoTeacherException.java
// public class NoTeacherException extends Exception {
// }
// 
// Path: exercises/observing-the-teacher/src/main/java/nl/han/dea/exercises/model/Course.java
// public class Course {
// 
//     Teacher teacher;
//     List<Observer> attendees;
// 
//     public Course() {
//         attendees = new ArrayList<Observer>();
//     }
// 
//     public void startCourse() throws NoTeacherException, NoAttendeesException {
//         if (teacher == null) {
//             throw new NoTeacherException();
//         } else if (attendees.isEmpty()) {
//             throw new NoAttendeesException();
//         }
//         for (Observer attendee : attendees) {
//             teacher.addObserver(attendee);
//         }
//         teacher.teach();
//     }
// 
//     public void addAttendee(Observer attendee) {
//         attendees.add(attendee);
//     }
// 
//     public void setTeacher(Teacher teacher) {
//         this.teacher = teacher;
//     }
// 
//     public void leave(Observer attendee) {
//         this.teacher.deleteObserver(attendee);
//     }
// }
// 
// Path: exercises/observing-the-teacher/src/main/java/nl/han/dea/exercises/model/Student.java
// public class Student implements Observer {
// 
//     private final String name;
//     private final Course course;
// 
//     private int numberOfNotes = 10;
// 
//     public Student(String name, Course course) {
// 
//         this.name = name;
//         this.course = course;
//     }
// 
//     private void makeNotes(String note) {
//         System.out.println("Student " + name + " made note: \n" + note);
// 
//         numberOfNotes--;
// 
//         if (numberOfNotes == 0) {
//             System.out.println("Student " + name + " has left the classroom");
//             course.leave(this);
//         }
//     }
// 
//     public void update(Observable o, Object arg) {
//         makeNotes((String) arg);
//     }
// }
// 
// Path: exercises/observing-the-teacher/src/main/java/nl/han/dea/exercises/model/Teacher.java
// public class Teacher extends Observable implements Observer{
// 
//     private final String name;
//     private Teachings teachings;
// 
//     public Teacher(String name) {
//         this.name = name;
//         this.teachings = Teachings.getInstance();
//     }
// 
//     public void teach() {
//         while (countObservers() > 0) {
// 
//             String wisdom = teachings.getWisdom();
//             say(wisdom);
//             try {
//                 Thread.sleep(1000);
//             } catch (InterruptedException e) {
//                 e.printStackTrace();
//             }
//         }
// 
//         System.out.println("Where have all my students gone?");
//     }
// 
//     private void say(String wisdom) {
//         setChanged();
//         notifyObservers(wisdom);
//     }
// 
//     public void update(Observable o, Object arg) {
//         System.out.println("hmmmm, intersting way of putting things.");
//     }
// }


// Path: exercises/observing-the-teacher/src/main/java/nl/han/dea/exercises/CourseApp.java
import nl.han.dea.exercises.exceptions.NoAttendeesException;
import nl.han.dea.exercises.exceptions.NoTeacherException;
import nl.han.dea.exercises.model.Course;
import nl.han.dea.exercises.model.Student;
import nl.han.dea.exercises.model.Teacher;

package nl.han.dea.exercises;


public class CourseApp {
    public static void main(String[] args) {
        Course course = new Course();