Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package com.mycompany.ja12;
- import java.util.ArrayList;
- import java.util.List;
- public class Employee {
- private String name;
- private String salary;
- //
- private List<Employee> subordinates;
- public Employee(String name){
- this.name = name;
- subordinates = new ArrayList<>();
- }
- public void add(Employee e){
- subordinates.add(e);
- }
- public void remove(Employee e){
- subordinates.remove(e);
- }
- // получаем всех подчиненных
- public List<Employee> getSubordinates(){
- return subordinates;
- }
- public String getSalary() {
- return salary;
- }
- public void setSalary(String salary) {
- this.salary = salary;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement