Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Profile
- {
- string name;
- string id;
- DateTime hiredate;
- DateTime birthday;
- double salary;
- string position;
- Department department;
- public Profile(string name, string id, DateTime hiredate, DateTime birthday, string position, double salary)
- {
- this.name = name;
- this.id = id;
- this.hiredate = hiredate;
- this.birthday = birthday;
- this.salary = salary;
- this.position = position;
- }
- public void assignDept(Department department) => this.department = department;
- public string getID() { return id; }
- public double getSal() { return salary; }
- public string[] Data()
- {
- return new string[]
- {
- name,
- id.ToString(),
- birthday.ToShortDateString(),
- hiredate.ToShortDateString(),
- position,
- Convert.ToString(salary)
- };
- }
- public bool isCandidate()
- {
- TimeSpan difference = DateTime.Now.Subtract(hiredate);
- if ((difference.Days / 365) >= 20)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- }
- public class Department
- {
- public string name;
- List<Profile> profiles;
- Profile depHead;
- public List<Profile> Profiles { get => profiles; set => profiles = value; }
- public Department(string name)
- {
- this.name = name;
- this.profiles = new List<Profile>();
- }
- public Department(string name, List<Profile> profiles)
- {
- this.name = name;
- this.profiles = profiles;
- }
- public Department(string name, List<Profile> profiles, Profile depHead)
- {
- this.name = name;
- this.profiles = profiles;
- this.depHead = depHead;
- }
- public void addHead(Profile newhead) => this.depHead = newhead;
- public int employeeCount() { return profiles.Count; }
- public void addProfile(Profile employee) => profiles.Add(employee);
- }
Add Comment
Please, Sign In to add comment