Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. ********HourlyEmployee.cs********
  2.  
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8.  
  9. namespace ARTPLibrary
  10. {
  11. public class HourlyEmployee: Employee
  12. {
  13. //fields
  14. //none b/c automatic properties
  15.  
  16. //properties
  17. public decimal HoursWorked { get; set; }
  18. public decimal HourlyWage { get; set; }
  19.  
  20. //ctors
  21. public HourlyEmployee(int id, string fName, string lName, DateTime dob, string jobTitle, DateTime hireDate, decimal hoursWorked, decimal hourlyWage, bool isDirectDeposit): base (id, fName, lName, dob, jobTitle, hireDate, isDirectDeposit)
  22. {
  23. HoursWorked = hoursWorked;
  24. HourlyWage = hourlyWage;
  25. }
  26.  
  27. //methods
  28.  
  29. //ToString()
  30. public override string ToString()
  31. {
  32. return $"{base.ToString()}\nHours Worked: {HoursWorked:f2}\nHourly Wage: {HourlyWage:c}";
  33. }
  34. }
  35. }
  36.  
  37.  
  38. ********Program.cs********
  39. HourlyEmployee he = new HourlyEmployee(456, "James", "Smith", new DateTime(1985, 06, 05), "Janitor", new DateTime(2020, 03, 30), 38.7m, 12.25m, false);
  40. Console.WriteLine("\nCreate and output an Hourly Employee object.\n" + he);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement