inh-01-employees/Employees/OfficeEmployee.cs
2025-02-27 17:11:51 +01:00

25 lines
897 B
C#

namespace Employees;
/// <summary>
/// Represents an employee who works at an office
/// </summary>
/// <inheritdoc cref="Employee" />
public class OfficeEmployee : Employee
{
/// <summary>
/// Creates a new employee who works at an office
/// </summary>
/// <param name="name">Name of the employee</param>
/// <param name="gender">Gender of the employee</param>
/// <param name="department">Department of the employee</param>
/// <param name="monthlySalary">Monthly salary of the employee; cannot be negative</param>
public OfficeEmployee(string name, Gender gender, string department,
decimal monthlySalary) : base(name, gender, department)
{
Salary = Math.Max(0M, monthlySalary);
}
public override decimal Salary { get; }
public override string ToString() => $"{base.ToString()} as an employee";
}