Reputation: 67
an UML class diagram that pictures an high school administration system is required.
further, it is asked to design the following:
a) which Teacher, teaches which Class, in which Subject, for how many hours/week?
b) is there a safe way to assure that a Teacher only teaches Subjects he has a Certificate for?
after fuzzing around several hours i came up with this: .
but i still can not imagine how to design the diagram in a way that all (or at least three) of the conditions from a) are presented as required.
is there actually a way to do so in a UML class diagram?
edit: after reading Ayo Ks comment i came up with this:
Upvotes: 0
Views: 3199
Reputation: 1774
which Teacher, teaches which Class, in which Subject, for how many hours/week?
This means that what binds the teacher to a class is a Subject. Since there are multiple subjects, a teacher will have a property that represents a list of subject, and a class will also have a list of subjects. For representing how many hours/week, this will be tied to the subject. A subject should have a property representing how many hours it should last and a property representing how many times a week it is taught. This way once a teacher teaches a subject, by getting the subject the teacher takes, you can pick out how many times a week and how may hours
b) is there a safe way to assure that a Teacher only teaches Subjects he has a Certificate for?
For this since a certification is tied to a subject, things will change a bit. This will mean that a Teacher will no longer have a List of subjects as a property but rather a list of certifications, so by getting the certifications a teacher has, you can get the subject(s) the teacher can take from the certifications and the number of hours/week the teacher takes the subject
Hope this helps you in finishing your diagram.
Upvotes: 1