private boolean containsCourse(ArrayList<StudentCourse> list, int code) {
   for (StudentCourse object : list) {
     if (object.getCode() == code) {
       return true;
     }
   }
   return false;
 }
  private void removeCourseFromSchedule(ArrayList<StudentCourse> schedule, int code) {

    Iterator<StudentCourse> it = schedule.iterator();
    while (it.hasNext()) {
      StudentCourse course = it.next();
      if (course.getCode() == code) {
        it.remove();
      }
    }
  }
  private ArrayList<StudentCourse> checkRequirements(ArrayList<StudentCourse> schedule) {
    ArrayList<StudentCourse> results =
        (ArrayList<StudentCourse>) dbHelper.getAllCoursesNotTakenByStudent(user_id, "false");

    Iterator<StudentCourse> it = schedule.iterator();
    while (it.hasNext()) {
      StudentCourse course = it.next();
      switch (course.getCode()) {
        case 101:
          {
          }
          break;
        case 102:
          {
            if (containsCourse(results, 101)) {
              it.remove();
            }
          }
          break;
        case 203:
          {
            if ((containsCourse(results, 101)) || (containsCourse(results, 102))) {
              it.remove();
            }
          }
          break;
        case 204:
          {
            if ((containsCourse(results, 101)) || (containsCourse(results, 102))) {
              it.remove();
            }
          }
          break;
        case 300:
          {
          }
          break;
        case 306:
          {
            if (containsCourse(schedule, 101)) {
              it.remove();
            } else if (containsCourse(schedule, 102)) {
              it.remove();
            } else if (containsCourse(schedule, 307)) {
              it.remove();
            }
          }
          break;
        case 307:
          {
            if (containsCourse(schedule, 101)) {
              it.remove();
            }
            if (containsCourse(schedule, 102)) {
              it.remove();
            }
          }
          break;
        case 320:
          {
          }
          break;
        case 408:
          {
            if (containsCourse(schedule, 101)) {
              it.remove();
            } else if (containsCourse(schedule, 102)) {
              it.remove();
            } else if (containsCourse(schedule, 307)) {
              it.remove();
            }
          }
          break;
        case 411:
          {
            if (containsCourse(schedule, 101)) {
              it.remove();
            } else if (containsCourse(schedule, 102)) {
              it.remove();
            } else if (containsCourse(schedule, 307)) {
              it.remove();
            }
          }
          break;
        case 412:
          {
            if (containsCourse(schedule, 101)) {
              it.remove();
            } else if (containsCourse(schedule, 102)) {
              it.remove();
            } else if (containsCourse(schedule, 307)) {
              it.remove();
            }
          }
          break;
        case 413:
          {
            if (containsCourse(schedule, 101)) {
              it.remove();
            } else if (containsCourse(schedule, 102)) {
              it.remove();
            } else if (containsCourse(schedule, 307)) {
              it.remove();
            }
          }
          break;
        case 414:
          {
            if (containsCourse(schedule, 101)) {
              it.remove();
            } else if (containsCourse(schedule, 102)) {
              it.remove();
            } else if (containsCourse(schedule, 307)) {
              it.remove();
            }
          }
          break;
        case 415:
          {
            if (containsCourse(schedule, 101)) {
              it.remove();
            } else if (containsCourse(schedule, 102)) {
              it.remove();
            } else if (containsCourse(schedule, 307)) {
              it.remove();
            } else if (containsCourse(schedule, 408)) {
              it.remove();
            }
          }
          break;
        case 424:
          {
            if (containsCourse(schedule, 101)) {
              it.remove();
            } else if (containsCourse(schedule, 102)) {
              it.remove();
            } else if (containsCourse(schedule, 307)) {
              it.remove();
            } else if (containsCourse(schedule, 414)) {
              it.remove();
            }
          }
          break;
      }
    }

    return schedule;
  }