Question: 4. [13 Marks] The Employee Class (a) Code an Employee Class with private field variables of id (int), firstName and lastName (String) and salary (double).

 4. [13 Marks] The Employee Class (a) Code an Employee Class

4. [13 Marks] The Employee Class (a) Code an Employee Class with private field variables of id (int), firstName and lastName (String) and salary (double). (2 Marks] (b) Code the constructor using all the variables as above. [2 Marks] (c) Id, firstName and lastName once assigned through the constructor will not be updated. Whereas salary need to updated from time to time. Therefore, define only the setters and getters needed as per the requirements mentioned here. [2 Marks] (d) Code a method raise Salary(int percentIncrease). Based on the percent increase in salary the salary of the employee should be updated. [2 Marks] (e) Code the employee Details method to print the Employee Details. [2 Marks) (1) Code a separate TestEmployeeClass, where an Employee Class object is instantiated. Then construct it using employee name: "Tom Hanks'', Id:1000 and a Salary of 10500. Print using employee Details the details of the employee. Then raise the salary by 10% and print again using employee Details the updated employee details of "Tom Hanks". As shown in the class, all the changes must be inbuilt in the Employee Class. There must not be any methods or computation be coded in the Tester Class except defining the Object and calling the methods. [3 Marks]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!