NETD 3202 – Lab 3
It can be difficult to retain people using piecework payroll. To reduce worker attrition, Incorporeal Incorporated is considering paying a small bonus to especially high-producing employees. If the model for sourcing workers is changed this may end up leading to the ability to give users promotions later.
This Lab is a direct extension of Lab 1 and 2. Ensure you are familiar with the Lab 1 and 2 requirements prior to reading and attempting this Lab.
Business Tier – Piecework Worker Class Changes:
- Make the required change to the access specifier for your pay calculation method to allow access by the presentation tier.
- Remove the call to your pay calculation method from the parameterized constructor as now that method will now be called separately after object instantiation from the presentation tier.
- The pay calculation should be adjusted so that $20 pay is added as a bonus to a worker’s pay when they exceed 1200 messages sent or $30 when they exceed 2000 messages sent. These amounts are not cumulative.
- Adjust the validation for the number of messages to ensure this value is an integer between 1 and 3000.
Presentation Tier – Piecework Input Form Changes:
- Add a label to your form in close proximity to the worker pay display that can be used to output a message related to productivity.
- When a worker produces more than 1200 messages, display a message that the worker is receiving the $20 bonus. Include the worker’s name in this message.
- When a worker produces more than 2000 messages, display a message that the worker is receiving the $30 bonus. Include the worker’s name in this message.
- Ensure that you consider this new controls in any applicable keyboard access.
Presentation Tier – Summary Form:
- No changes; all behavior expected in Lab 1 and 2 should still be present.
Changes to the Pay Calculation:
- The user enters the worker name and number of messages.
- The user then clicks the “Calculate Pay” button.
- Accept worker name and number of pieces ensuring that both are validated as outlined previously.
- Once all validation passes, you should implement the appropriate property procedures to write the values to the instantiated object and call the appropriate method to calculate pay.
Implementing Exception Handling
- At the presentation level, your block of statements to set the object properties should be enclosed in a try statement that will capture an exception thrown by the class definition. In particular you are expecting an “argument out of range” exception that might be thrown by either the non-validation of worker name or number of pieces as previously described.
- Back at the presentation tier check the parameter name of the exception caught, and based on that name, send an appropriate message, select all and set the focus in the offending text box.
- After successfully setting all object properties and calling the method to calculate pay, access the “Total Pay” property procedure for the current object and output it in the total pay label formatted as Currency.
- The program must be adequately documented:
- functions should all have block comments
- calculations, decisions and iteration should be explained with brief comments
- there should be a header at the top of the file including your name, the last modified date, and a description
- Consider an approved style guide and ensure your variable names and other elements are properly cased and adequately descriptive
Enhancements for Stock:
- You earn 2 bonus stock if the string validation successfully checks that the worker has a first and last name each consisting of at least two letters
- You earn 3 bonus stock if the productivity messages are implemented using a user-defined event created in the business logic tier and handled at the presentation tier with an event handler