Task 1 Task 2 Task 3

Task 1

Create a new Java project called EmployeeProject.

Create an Employee class that keeps data attributes/properties for the following pieces of information:

Make sure the data attributes are private (data hiding).

Design an appropriate constructor method for this class.

Task 2

Write appropriate accesor methods for each of the class properties.

Task 3

Write a mutator method for the yearsOfService property. This simply adds 1 to the current yearsOfService each time it is called.


Task 4

Write a private class method, calculatePayRise. This determines and returns the payrise percentage based on the following rules:

  1. 1-3 years service, pay rise of 5%
  2. 4-6 years service, pay rise of 7%
  3. 7-10 years service, pay rise of 10%
  4. 10+ years service, payrise of 12%

Task 5

Write a mutator method for the hourlyRate property. This calls the calculatePayRise method and uses the returned value to update the hourlyRate property.


Task 6

Write a main program which will fully test the design of the class.


Task 7

Draw a UML diagram for the Employee class.