POO Hands On5
POO Hands On5
NTIC Faculty
Second year common core
2023–2024
Exercise 3: Attributes
Enrich the ’Course’ and ’Person’ classes defined in Exercise 2 above with:
- A set of attributes: last_name, f irst_name, and age for the ’Person’ class, and course_code and
teacher_code for the ’Course’ class.
- A set of empty methods representing the behavior of objects of these classes.
1. Define additional classes in Java such as ’Book’, ’Library’, and ’Author’. Mention the attributes and
methods you would include for each class.
2. Instantiate objects of the ’Book’, ’Library’, and ’Author’ classes.
3. In a Main class, perform operations on these objects to showcase their functionality.
2
Exercise 10: Advanced Employee Management System
1. Create a class ’Address’ in Java with attributes like street, city, and postal code.
2. Modify the ’Employee’ class to have an attribute address of type ’Address’.
3. Define a class ’Company’ that can manage a list of ’Employee’ objects.
4. Implement methods in the ’Company’ class to hire, fire, and display employees along with their
addresses.
5. Create a ’Main’ class to showcase the employee management system. Hire, fire, and display employee
information along with their addresses using the company object.