Project 4 is designed to build on the fundamental concepts and techniques to further an understanding of the use of and overloaded methods, and to build skills in creating Windows form-based projects. This program is implemented in the Visual C# .Net Windows Application (Forms) environment.
• Use the Visual Studio IDE to place controls on a Windows Form
• Use Label, TextBox, Button, GroupBox, MenuStrip, CheckBox, and MessageBox controls
• Set properties for controls at design time and run time
Project 4 is an extension of Project 2 and presents a form based application to calculate and display payroll information for employees. For this project assume that there are two distinct categories of employees: production workers, and salespersons. This project requires you to properly compute gross pay for salespersons as well as production workers. Some of this logic was created in Project 2.
Gross pay earned each week depends upon hours worked and wage rate for production workers. For salespersons, gross pay depends on sales, hours worked, and wage rate. Taxes deducted are determined in the same way for both groups, as is described below and as required for Project 2.
This project is designed to allow an employee user to enter their hours worked, wage rate, and number of dependents with TextBoxes. A CheckBox is used to determine whether the worker is a salesperson. If the employee is a salesperson, an additional Label and TextBox are displayed allowing the user to enter the dollar amount of their sales for the period. Handle this by changing the “Visible” property of the Label and TextBox from false to true (or vice versa depending on if the box is checked or not) when the CheckedChanged event for the checkbox is fired. Once these entries are made, the user clicks a button to cause the program to calculate and display gross pay, taxes owed, and net pay in a group of Labels. Gross pay, taxes owed, and net pay are to be determined by calling appropriate methods.
The three textboxes in the Pay Summary group box should have their ReadOnly property set to true. The content of all textboxes should be right-aligned.
1. Create a new project.
2. Project Type (Visual C#)
3. Template (Windows Forms Application)
4. Name (Project04LastNameFirstInitial)
5. Include your name, the course and section, the class name, and a brief description of the program in a multi-line comment at the top the class file
6. Include internal documentation
7. When completely finished and ready for grading, (1) ensure your full solution folder is on the J: drive, and (2) attach your PayEstimatorForm.cs class file, then click the submit button for the assignment in BbLearn. Verify that it has been attached and submitted.
A MenuStrip control is added with the following menu items:
• File/Exit exits the application
• Help/About displays a message box with the program name and version (see screenshot)
• Compute button calculates gross pay, taxes, and net pay and populates the bottom 3 textboxes. Call the methods to calculate gross pay, tax, and net pay.
• Clear form button clears all textboxes on the form and unchecks the Salesperson checkbox
• Exit button exits the application
• Sales Person checkbox will toggle the visibility of the salesperson label and text box
In addition to the code in your button_click() methods, the following 4 methods must be created. You will find it easier and avoid temporary syntax errors if you code these 4 methods first:
CalculateGrossPay()— For non-salespersons. 2 parameters: hours worked, wage rate. Return a double.
Gross pay is calculated as follows: Employees are paid by their hours worked times their wage rate and receive an overtime bonus of 1/2 their wage rate for each hour worked beyond 40. Return the gross pay.
CalculateGrossPay() –For salespersons . 3 parameters: hours worked, wage rate, sales amount. Return a double.
Gross pay is calculated as follows: Employees are paid by their hours worked times their wage rate (no overtime bonus is given). In addition, a commission equal to 2 percent of sales up to $10,000 is paid and when the sales amount exceeds $10,000, a commission of 4 percent is paid for those sales exceeding the $10,000 quota. In other words, if sales are $11,000, commission will be 2% on the first $10,000 and 4% on the remaining $1,000. Return the gross pay.
CalculateTaxes() 2 parameters: dependents and gross pay. Return a double.
10% of gross pay up to a pay cutoff [$100 + ($100 * the number of dependents)] then 20% of gross pay above this level . Return the taxes owed.
CalculateNetPay() 2 parameters: Gross pay and taxes Return a double.
Subtract taxes from gross pay. Return the net pay.
• Declare double variables for hours worked, hourly rate, sales amount, gross pay, taxes, and net pay
• Declare a boolean variable called isSalesPerson
• Declare an integer variable for dependents
• Get variable values for hours worked, hourly rate, and dependents from the form textboxes
• Set the value of the isSalesPerson variable based on the checked status of the checkbox (you will have to use an if statement here)
• If isSalesPerson is true:
o Get the value for sales amount from the form textbox
o Call the CalculateGrossPay() method, passing in hours worked, hourly rate, and sales amount as parameters and store the result of this method call into the gross pay variable.
o Call the CalculateGrossPay() method, passing in hours worked and hourly rate as parameters and store the result of this method call into the gross pay variable.
• Call the CalculateTaxes() method, passing in the appropriate parameters and store the result of this method call in the taxes variable
• Call the CalculateNetPay() method, passing in the appropriate parameters and store the result of this method call in the net pay variable
• Populate the gross pay, taxes, and net pay text boxes with their calculated values. Ensure they are formatted as currency like in the screenshots.
Screenshots (ensure that your output numbers match when using the same inputs and your formatting matches)