I want to model a simple system using a Class Diagram:
- I have 3 possible classes:
Company,Employee,Manager. - The
Companymust have 20Employees(aggregation?). - The
Companymust have 1Manager(aggregation?). - A
Manageris an Employee (generalization?). - Each
Employeecan only be in 1Company.
In other words, I want to limit this system to have 20 Employees, 1 of which must be a Manager. However ONLY 1 can be a Manager. This would make it so that there are 19 Employees and 1 Manager objects at all times.
I have the setup in my head of how I want this system to work, but I can't get the model quite right. This is what I got:
I feel like I am very close, but my issue is that although the Company 1 to 1 relationship to the Manager seems correct, the 1 to 19 to the Employee seems off. Since a Manager is an Employee, I have no way of limiting how many of those 19 Employees are Managers. I am trying to do this without splitting Employees up into Non-Manager and Manager classes.
Am I on the right track? Is there something I am missing? Or is it clear enough that 19 MUST be Employee objects and 1 MUST be Manager object?
