Guest User

Untitled

a guest
Jan 20th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. public class Profile
  2. {
  3. string name;
  4. string id;
  5. DateTime hiredate;
  6. DateTime birthday;
  7. double salary;
  8. string position;
  9. Department department;
  10.  
  11. public Profile(string name, string id, DateTime hiredate, DateTime birthday, string position, double salary)
  12. {
  13. this.name = name;
  14. this.id = id;
  15. this.hiredate = hiredate;
  16. this.birthday = birthday;
  17. this.salary = salary;
  18. this.position = position;
  19. }
  20.  
  21. public void assignDept(Department department) => this.department = department;
  22. public string getID() { return id; }
  23. public double getSal() { return salary; }
  24.  
  25. public string[] Data()
  26. {
  27. return new string[]
  28. {
  29. name,
  30. id.ToString(),
  31. birthday.ToShortDateString(),
  32. hiredate.ToShortDateString(),
  33. position,
  34. Convert.ToString(salary)
  35. };
  36. }
  37.  
  38. public bool isCandidate()
  39. {
  40. TimeSpan difference = DateTime.Now.Subtract(hiredate);
  41. if ((difference.Days / 365) >= 20)
  42. {
  43. return true;
  44. }
  45. else
  46. {
  47. return false;
  48. }
  49. }
  50. }
  51. public class Department
  52. {
  53. public string name;
  54. List<Profile> profiles;
  55. Profile depHead;
  56.  
  57. public List<Profile> Profiles { get => profiles; set => profiles = value; }
  58.  
  59. public Department(string name)
  60. {
  61. this.name = name;
  62. this.profiles = new List<Profile>();
  63. }
  64.  
  65. public Department(string name, List<Profile> profiles)
  66. {
  67. this.name = name;
  68. this.profiles = profiles;
  69. }
  70.  
  71. public Department(string name, List<Profile> profiles, Profile depHead)
  72. {
  73. this.name = name;
  74. this.profiles = profiles;
  75. this.depHead = depHead;
  76. }
  77.  
  78. public void addHead(Profile newhead) => this.depHead = newhead;
  79. public int employeeCount() { return profiles.Count; }
  80. public void addProfile(Profile employee) => profiles.Add(employee);
  81. }
Add Comment
Please, Sign In to add comment