Advertisement
sergAccount

Untitled

Aug 30th, 2020
1,174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.33 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package com.spec;
  7.  
  8. import java.util.ArrayList;
  9. import java.util.List;
  10.  
  11. /**
  12.  *
  13.  * @author Admin
  14.  */
  15. public class Employee {
  16.  
  17.     private String name;
  18.     private String dept;
  19.     private int salary;
  20.     private List<Employee> subordinates;
  21.     //
  22.  
  23.     public Employee(String name, String dept, int salary) {
  24.         this.name = name;
  25.         this.dept = dept;
  26.         this.salary = salary;
  27.         subordinates = new ArrayList<>();
  28.     }
  29.     //
  30.     public void add(Employee s){
  31.         subordinates.add(s);
  32.     }
  33.     //
  34.     public String getName() {
  35.         return name;
  36.     }
  37.  
  38.     public void setName(String name) {
  39.         this.name = name;
  40.     }
  41.  
  42.     public String getDept() {
  43.         return dept;
  44.     }
  45.  
  46.     public void setDept(String dept) {
  47.         this.dept = dept;
  48.     }
  49.  
  50.     public int getSalary() {
  51.         return salary;
  52.     }
  53.  
  54.     public void setSalary(int salary) {
  55.         this.salary = salary;
  56.     }
  57.  
  58.     public List<Employee> getSubordinates() {
  59.         return subordinates;
  60.     }
  61.  
  62.     public void setSubordinates(List<Employee> subordinates) {
  63.         this.subordinates = subordinates;
  64.     }
  65. }
  66.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement