Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Employee {
- private String name;
- private int salary;
- private Employee boss;
- public Employee(String name, int salary, Employee boss){
- this.name = name;
- this.salary = salary;
- this.boss = boss;
- }
- /*return the salary of the employee*/
- public int getSalary(){
- return salary;
- }
- /**increase the employee's salary(decrease it if increase is negative)**/
- public void giveRaise(int increase){
- if(increase<0)
- this.salary -= increase;
- else
- this.salary += increase;
- }
- /**return the number of group members whose bosses earn more than this E**/
- public int importantCount(Employee[] group){
- int count = 0;
- for(int i = 0; i < group.length; i++){
- if(group[i].boss.salary>this.boss.salary)
- count +=1;
- }
Advertisement
Add Comment
Please, Sign In to add comment