Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. public class Employee {
  2. private String name;
  3. private int salary;
  4. private Employee boss;
  5.  
  6. public Employee(String name, int salary, Employee boss){
  7. this.name = name;
  8. this.salary = salary;
  9. this.boss = boss;
  10. }
  11.  
  12. /*return the salary of the employee*/
  13. public int getSalary(){
  14. return salary;
  15. }
  16.  
  17. /**increase the employee's salary(decrease it if increase is negative)**/
  18. public void giveRaise(int increase){
  19. if(increase<0)
  20. this.salary -= increase;
  21. else
  22. this.salary += increase;
  23. }
  24.  
  25. /**return the number of group members whose bosses earn more than this E**/
  26. public int importantCount(Employee[] group){
  27. int count = 0;
  28.  
  29. for(int i = 0; i < group.length; i++){
  30. if(group[i].boss.salary>this.boss.salary)
  31. count +=1;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement