Homework 5 (C# Advanced Class Construction)

 

Ø Make a stepwise refinement, WinEmployee5.exe Windows App, that manages Employee data. The App is demonstrated without source by Homework5.exe

 

Ø     (20) Implement “comparable” employees. Add a sort by Name, and by Employee ID, to the Employs class, with an appropriate test display such as a “DomainUpDown” control.

§         Make the Employee class comparable by “FullName” default

§         Add a custom IComparer interface implementation for “EmpID”

§         Add NameSort() and EmpIDSort() methods to Employs

Ø     ( 5) Make each Employee cloneable

§         Implement ICloneable for Employee

§       Show that the emp.Clone() works, perhaps in the manufacture of test data

Ø     (20) Add an indexer to Employs for the “FullName” string, and EmpID

§         Show that the empList[“FullName”] works, perhaps as part of a “Display Selected” pick

§         Same with empList[EmpID]

 

Ø     (10) Implement Operators ++ and -- for Employs

§         Define “++” (go to Next) and --” (go to Previous) overloaded Employs Class operators. Implement “Next” and “Previous” Buttons that use the operators and indexers.

 

Ø     (15) Use the code for the “Make Test Employees” button to clone, index, sort, and otherwise muck about with new code.

 

Ø     Implement a FinanceDept class for use with multicast delegates and events. Change “Compute Payroll” to use multicast delegate for “foreach( employee)” payroll calculation, and an event for the payroll finish

Ø     (15) Have two routines called as part of the same multicast delegate.

Ø      The bonus one should be optional, chosen via checkbox.

§         public void AdmGiveBonus( Employee emp) // copied bonus calc

§         public void AdmGivePay( Employee emp)     // copied pay stuff

Ø     (15) Have two routines used in an event.

Ø      FileItOut() should be an optional part of the event, chosen via checkboxes.

§         public void FileItOut()                  // put out “pay.dat”

§         public void ResetStats() // finish payroll, reset totals and such

 

Ø     EXTRA CREDIT (10 points): Use “Asynchronous Delegate Method” calls. This could be for the “Compute Payroll”, or for any button such as “Save Employees to a File”.

 

Ø     EXTRA CREDIT (5 points): Use the “///” XML Doc capability to appropriately comment public methods, properties, and fields

Ø      Note: This will be required in the final project, and in upcoming assignments as specified

 

NOTE BENE: Future assignments will build on the current Employee App

§        The Employees class will be improved to

§        Be written and recovered to a file (via Serialization)

§        Be written and recovered to an ADO.NET database

§        Have much more appropriate GUI elements

§        Much more