Advertisement
social1986

Untitled

Feb 16th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. using System.Collections.Generic;
  2. using System.Linq;
  3.  
  4. public class Department
  5. {
  6. private List<Employee> employees;
  7. private string name;
  8. decimal averageSalary;
  9.  
  10.  
  11. public Department()
  12. {
  13. Employees = new List<Employee>();
  14. }
  15.  
  16. public void AddEmployee(Employee employee)
  17. {
  18. this.Employees.Add(employee);
  19. }
  20.  
  21. public decimal AverageSalary => Employees.Select(e => e.Salary).Average();
  22.  
  23. public List<Employee> Employees
  24. {
  25. get { return this.employees; }
  26. set { this.employees = value; }
  27. }
  28.  
  29. public string Name
  30. {
  31. get { return this.name; }
  32. set { this.name = value; }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement