Express the following constraints using OCL, with respect to the model. a) A Course should have no prerequisites that are higher level courses. ____________ b) All instructors for a Section must be able to teach (canTeach) the Course. ____________
Expert Answer
5.
a) [2 points] A Course should have no prerequisites that are higher level courses.
context: Course inv: prerequisite->forAll(c | c.level <= self.level)
b) [2 points] All instructors for a Section must be able to teach (canTeach) the Course.
context: Section inv: instructor->forAll(p | p.canTeach->includes(self.Course))
Let me know if you are satisfied with this