And I want to override the setTotalSalary in the subclass to do the following:
1- add overtime hours for the Janitor to the salary. (in the Janitor sub class).
2- add a percentage of the sales to the salesman salary.(in the Salesman sub class).
Is it possible guys ?
posted 6 years ago
Your setAllowance method with the instanceof is hardly good object-orientation. You should have the allowance percentage in the different classes, then call it from the Employee instance.