Reputation: 77
I've recently came across this question and I'm just curious if my work is correct, and if not, where I made a mistake.
My Task:
a) Officials are appointed on a temporary or permanent basis. Professors are civil servants who may be appointed for a fixed term or for life. Professors are also either teaching professors or heads of study. Employees of a scientific institute are civil servants or employees. Professors are subordinate to the Minister of Science, employees of the scientific institute are subordinate to the professors. Both professors and employees of the scientific institute work at the scientific institute. The institute can call meetings with professors and staff.
Create the appropriate UML Class Diagram.
My answer:
b) A professor can inform the secretariat that he or she would like to have an appointment with staff of the scientific institute. The secretariat will then send a list of proposed appointments to all the staff concerned. As soon as the secretariat has received feedback from all staff members, it will send the final appointment to each of them.
Create the corresponding UML Sequence Diagram.
My answer:
c) Implement the process from (b) in Java (method bodies are sufficient!). In doing so, adhere to the classes, abstract classes, and interfaces defined in (a).
My answer:
I tried to solve this problem, but I didn't get any further, especially that it is about solving the task with abstract classes and interfaces. I think this subtask can be solved without abstract classes and interfaces, right?
should the scientific institute be implemented as an abstract class?
Can someone please explain it to me? Thanks so much :)
Upvotes: 2
Views: 446
Reputation: 73366
There is a mistake since professor
are civil-servant
who are co-worker
who are subordinate to professor
: in your narrative a professor is subordinate of the ministry and not of another professor.
What I understand from the narrative is that employees who work in a scientific institute
and are subordinate to
a professor
can only be employee
.
In your diagram, a part of the narrative disappeared :
fulltime_employee
. It's not clear how these relate to temporary and permanent employee. meeting
which would relate to staff and professors. In your diagram there is also a rigidity that does not exist in the real world: a professor
may start career and one day be promoted to director of studies
. It's still the same professor. It's just the role that changed. Here I suggest to think about preferring composition over inheritance.
Seems reasonable to me, except that:
This is a complex question on its own. Better ask this as a separate question. But you need to be more specific.
Hint: an abstract class, is a class that cannot be instantiated: classes inheriting from it must implement its abstract methods so that objects can be instantiated.
Upvotes: 2