static void Main(string[] args) { Employee tony = new Employee(); tony.Income = 1500000; tony.YearsOfService = 8; tony.SetRating(Employee.Rating.excellent); tony.CalculateRaise(); }
static void Main(string[] args) // Main driver to run program { Employee tony = new Employee(); // instantiate new object employee tony.Income = 150000; // Set the employee property:: income(150k) to tony tony.YearsOfService = 8; // Set the employee property :: years of service(8) to tony tony.SetRating(Employee.Rating.excellent); // Set the method SetRating with enum parameters to tony tony.CalculateRaise(); // Tony object calls the method Calculate raise }
static void Main(string[] args) { var fechaInicio = new DateTime(2010, 01, 01); var fechaFin = new DateTime(2010, 01, 02); TimeSpan diferencia = fechaFin - fechaInicio; List <Employee> empleados = new List <Employee>(); Employee tony = new Employee { Nombre = "Tony", FechaAlta = new DateTime(1998, 01, 01), Income = 120000 }; tony.SetRating(Employee.Rating.excellent); //tony.FechaAlta = "01/01/2010"; empleados.Add(tony); Employee pepe = new Employee("Pepe", new DateTime(2010, 01, 01), 160000); pepe.SetRating(Employee.Rating.poor); empleados.Add(pepe); foreach (Employee empleado in empleados) { empleado.CalculateRaise(); } }