Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections.Generic;
- using System.Linq;
- public class Department
- {
- private List<Employee> employees;
- private string name;
- decimal averageSalary;
- public Department()
- {
- Employees = new List<Employee>();
- }
- public void AddEmployee(Employee employee)
- {
- this.Employees.Add(employee);
- }
- public decimal AverageSalary => Employees.Select(e => e.Salary).Average();
- public List<Employee> Employees
- {
- get { return this.employees; }
- set { this.employees = value; }
- }
- public string Name
- {
- get { return this.name; }
- set { this.name = value; }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement