0% found this document useful (0 votes)
28 views1 page

Exercise 2

The document outlines an exercise for Object Oriented Programming focusing on a company structure including offices, departments, and employees. It requires the creation of a UML class diagram, implementation of classes, and a testing class to simulate a company named 'New Tech' with specific offices and departments. The program should allow user interaction for adding employees to the company's offices and departments.

Uploaded by

Rayyan Mostapha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views1 page

Exercise 2

The document outlines an exercise for Object Oriented Programming focusing on a company structure including offices, departments, and employees. It requires the creation of a UML class diagram, implementation of classes, and a testing class to simulate a company named 'New Tech' with specific offices and departments. The program should allow user interaction for adding employees to the company's offices and departments.

Uploaded by

Rayyan Mostapha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Lebanese University

Faculty of Sciences – section 5

I2211 – Object Oriented Programming

Exercise 2

Consider the following problem definition about companies and their offices, departments, and
employees:

Each company has a name and one or more offices. Departments are located in one or more
offices. An office has an address and one or more departments. One office in a company acts as
headquarter (central office). Each department has a name and a manager who is recruited from
the set of employees. An employee has a name and a title. The employees are associated with
the department they work in.
Note: If the company ceases to exist then the offices and departments should also be erased.

1. Define the UML class diagram for the presented problem. Show the details of each class
(list of attributes, constructor(s), and methods). All data fields should be private.

2. Implement the different classes of your model.

3. Implement a testing class with a main method in which you have to create one company
named “New Tech” with 2 offices located at Nabatieh and Tyr. The headquarter of this
company is the office located at Nabatieh. Add to the Nabatieh office an IT department and
to the Tyr office a human resources department and maintenance department. Once your
objects are created, propose to the user to add new employees to the company offices.
Propose a general menu to the user where she/he could be able to choose the office and
department of each employee. The user should also be able to enter as many employees
as needed during each run of your program.

Page 1/1

You might also like