As outlined in the background from Incorporeal Incorporated, their employees are paid to send text messages (usually filled with lies) to their clients. Although employees have yet to be paid, the company has come up with a piecework payroll plan to pay employees it just hasnt been implemented yet.
Part of an application has been inherited from another corporation that Incorporeal Incorporated has insisted they own the rights to adapt for commercial purposes. This includes the screenshot of a Windows form as shown below and a partly complete VB class file that has been provided. Victor from Incorporeal Incorporated has asked us to investigate WPF for improved scaling at high resolutions (he insists this will be useful as more features are added). We will be creating a new form similar to the old one and adapting the provided class, as well as making several changes. All currency will be in dollars.
This form is designed to receive a workers name and a number of pieces produced. When the Calculate Pay button is clicked, the textbox currently labelled Pieces Produced should be validated to check for a positive whole number. Depending on the number provided, a workers pay is calculated. This pay is then displayed in a label shown as Total Pay.
When the Clear Fields button is clicked, both text boxes and the label containing the resulting pay are cleared, and focus is set to the field for entering the workers name.
Required Changes for the Form Design
First, the form must be entirely re-created as a WPF Application using C# or VB
Change the title ensure there is absolutely no mention of Skynet; consider using Incorporeal Incorporated or IncInc instead
IncIncs application is designed to pay workers for sending text messages; it should read Messages Sent instead of Pieces Produced
Add the IncInc logo or something else suitable as an icon
Required Changes for the Worker Class
PieceworkWorkerVB.txt and PieceworkWorkerCS.txt have been provided in the Lab 1 assignment folder - it has three sections indicated with block comments that start with TO DO and these parts must be completed
Finish the findPay() method such that a workers calculated pay is based on the following table, rounded to the nearest cent:
Messages Sent
Price Paid Per Message for All Messages
1 - 2499
0.022
2500 - 4999
0.024
5000 - 7499
0.027
7500 - 10000
0.031
10000+
0.035
In the property Set procedures for the workers name, code validation ensuring that a name has been entered for the worker (it does not matter what is entered as long as it isnt blank)
In the property Set procedure for the number of messages sent, code validation to ensure that the messages are entered as a whole number greater than zero
Validation messages for the name and number of messages should be provided to the user with a message box or using an error provider do not put the error messages in a label on the form
If You Choose to Code Your Piecework Worker Class From Scratch
If you instead choose to start from scratch, ensure that your worker class includes all of the following:
a parametrized constructor and a default constructor
instance variables to hold the workers name and number of sent messages
shared variables to hold running totals for the number of employees processed, total of all calculated pay, and total number of messages sent
read/write property procedures for the workers name and number of messages
a read-only property procedure to access the workers calculated pay
shared, read-only property procedures to access the summary data, including the number of employees processed, total of all calculated pay, and total number of messages sent
a findPay() method to calculate a workers pay, which also updates the summary values above
This list may also be useful to any student who wants to ensure their worker class is complete.
General Function
When the Calculate Pay button is clicked, the textbox currently labelled Pieces Produced should be validated to check for a positive whole number. Depending on the number provided, a workers pay is calculated as shown in the table above
When a user clicks Calculate, the program attempts to create a new piecework worker object. The validation of this worker will take place within the worker class
If the workers name is not entered, a descriptive validation message will appear (in a message box or error provider) and the pay will not calculate
If the messages sent is not entered as a positive integer, a descriptive validation message will appear (in a message box or error provider) and the pay will not calculate
If everything validates properly, the workers calculated pay will be calculated (in the class / business logic) and displayed in an appropriate label (in the form / presentation logic), similarly to the screenshot above.
When the workers pay is entered, the entry fields and Calculate button should be disabled / greyed out and focus set to the Clear button
When the Clear button is pressed, both text boxes and the label containing the resulting pay are cleared, the textboxes and Calculate button are re-enabled, and focus is set to the field for entering the workers name
Additional Considerations
Pay attention to when your labels are cleared, and ensure no incorrect information is ever on-screen
The program must be adequately documented:
functions and event handlers should all have block comments
calculations, decisions and iteration should be explained with brief comments
there should be a header at the top of each forms code (and any other modules) including your name, the last modified date, and a description
Adhere to an approved style guide and ensure your variable names and other elements are properly cased and adequately descriptive
Consider accessibility; this application must be easily usable with keyboard only and any fields the user interacts with must have useful tooltips
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.