1. Use your class library from assignment7 - PersonLibrary (https://www.it2051229.com/csexercises9.html)

2. We have been asked to add the ability for certain employees to enroll in benefits

3. Both Managers and FullTimeEmployees should be able to Enroll.

  • Notice that Manager and FullTimeEmployee have different base classes
  • If we were to add the enrollment methods to the base class for FullTimeEmployee we would end up giving the functionality to PartTimeEmployee as well.
  • How can we fix this problem?
  • Using an Interface!

4. Create an interface IEnrollBenefits that defines the following methods

  • string Enroll();
  • string UnEnroll();

5. Implement the IEnrollBenefits interface in both the Full TimeEmployee and Manager class

  • For implementation you can simply return a string "Enrolling in benefits" or "Unenrolling in benefits"

6. In the base person class implement the IComparable Interface

  • Provide functionality to allow a collection of person to be sorted by last name

7. Add a UI layer of your choice

8. Create a List< Person > with at least 5 people

9. Display the List< Person >

10. Use the Sort() method to sort by last name

11. Create a method that takes an IEnrollBenefits as a parameter and displays the string from the Enroll() method

  • Notice that we can pass either a Manager or a FullTimeEmployee as a paramerter to this method because they both implement IEnrollBenefits.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.