using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace EmployeeManagement { class Employee { // Static variables. private static double minimumSalary = 70000; private static int numEmployees = 0; // Static methods/properties. public static void AdjustMinimumSalary(double amount) { minimumSalary += amount; Console.WriteLine(" Message from AdjustMinimumSalary: minimum salary is now {0}.", minimumSalary); } private PerformanceLevel performanceLevel = new PerformanceLevel(); public void ScoreEmployee(int score) { performanceLevel += score; } public TelephoneNumber TelephoneNumber { get; set; } // Instance variables. private DateTime joined; private string[] skills; private UserProfile profile; // Constructor 1. // Name only, rely on defaults for everything else. public Employee(string name) : this(name, DateTime.Today, new UserProfile(name.Replace(" ", ""), "password", "GeneralUser@CompanyDomain.com")) {} // Constructor 2. // Name, date joined, and profile. Plus salary and/or numskills. public Employee(string name, DateTime joined, UserProfile profile, double salary = 20000, int totalSkills = 10) { // Initialize this employee. this.Name = name; this.Salary = salary; this.joined = joined; this.skills = new string[totalSkills]; this.profile = profile; // Increment the (static) number of employees. numEmployees++; Console.WriteLine(" Message from Employee constructor: there are now {0} employee(s).", numEmployees); } // Destructor. ~Employee() { // Decrement the (static) number of employees. numEmployees--; Console.WriteLine(" Message from Employee destructor: there are now {0} employee(s).", numEmployees); } // Properties. public string Name { get; private set; } public double Salary { get; private set; } // Additional methods. public void PayRaise(double amount) { Salary += amount; } public override string ToString() { return string.Format("{0} joined {1}, salary {2:c}, performance level: {3}\n{4}.", Name, joined.ToShortDateString(), Salary, performanceLevel, profile); } } }