Tuesday, July 8, 2008

Parent Control for small kids and big kids



class ParentControl {
public void checkViewer(Person viewer, Program tv)
throws ForbiddenViewerAndProgramException {
if(viewer.getAge() < 13 && tv.isViolent()){
throw new ViolentProgramException();
}
if(viewer.getAge() < 13 && tv.isSexual()){
throw new ThisIsTooEarlyForYouException();
}
if(viewer.getAge() >= 30 && tv.isCartoon(){
throw new GoOutAndFindDatesException();
}
viewer.watch(tv);
}
}

No comments: