Consider the following description below:
In a company, each employee belongs to one department. One of the employees of a department is the Head of Department.
Each department occupies one or more offices. An office can be occupied by no department or by one department.
An employee is identified by an id and has a name. A department is identified by its name. An office is identified by its office number.
Draw a class diagram for the above scenario to show the types (classes) of objects that can exist and the relationships among them.
For each class, show
– The class name and
– The names of its mutator methods
You do not have to specify the attributes nor the parameters of the methods. Obviously, you should choose sensible names for the classes and methods.
For class diagram we must notice:
1. Each department has 1 or more office
2. Each office has no or more departments
3. Each employee associated with only 1 department
4. Each department associated with many employees.
Hence, the class diagram is:
Get Answers For Free
Most questions answered within 1 hours.