Question: Question: Write a Windows Forms application that calculates and prints the take - home pay for a commissioned sales employee. Allow the user to enter

Question: Write a Windows Forms application that calculates and prints the take-home pay for a commissioned sales employee. Allow the user to enter values for the name of the employee and the sales amount for the week. Employees receive 7% of the total sales. Federal tax rate is 18%. Retirement contribution is 15%. Social Security tax rate is 9%. Use appropriate constants. Write Input, Display, and Calculate methods. Your final output should display all calculated values, including the total deductions and all defined constants.
My Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Homework_6_Problem_3
{
public partial class Form1 : Form
{
private const double COMMISSION_RATE =0.07;
private const double FEDERAL_TAX_RATE =0.18;
private const double RETIREMENT_CONTRIBUTION_RATE =0.15;
private const double SOCIAL_SECURITY_TAX_RATE =0.09;
public Form1()
{
InitializeComponent();
}
private void BtnCalculate_Click(object sender, EventArgs e)
{
string employeeName = txtEmployeeName.Text;
if (double.TryParse(txtWeeklySales.Text, out double WeeklySales) && WeeklySales >0)
{
double Commission = WeeklySales * COMMISSION_RATE;
double FederalTax = Commission * FEDERAL_TAX_RATE;
double RetirementContribution = Commission * RETIREMENT_CONTRIBUTION_RATE;
double SocialSecurityTax = Commission * SOCIAL_SECURITY_TAX_RATE;
double TotalDeductions = FederalTax + RetirementContribution + SocialSecurityTax;
double NetPay = Commission - TotalDeductions;
txtFederalTax.Text = FederalTax.ToString("C");
txtRetirementContribution.Text = RetirementContribution.ToString("C");
txtSocialSecurity.Text = SocialSecurityTax.ToString("C");
txtNetPay.Text = NetPay.ToString("C");
}
else
{
MessageBox.Show("Total weekly sales must be a positive dollar amount. Please re-enter.");
}
}
private void BtnClear_Click(object sender, EventArgs e)
{
txtEmployeeName.Clear();
txtWeeklySales.Clear();
txtFederalTax.Clear();
txtRetirementContribution.Clear();
txtSocialSecurity.Clear();
txtNetPay.Clear();
}
private void BtnExit_Click(object sender, EventArgs e)
{
this.Close();
}
private void Label12_Click(object sender, EventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
My Windows Form App:
Employee Name:
Employee's Total Weekly Sales:
Employee Commission is 7% of total sales.
Deductions
Federal Tax (18%):
Retirement Contribution (15%):
Social Security (9%):
Total Net Pay:
Total Net Pay:
Exit
When I enter the employee's total weekly sales, the outputs, federal tax, retirement contribution, social security, and total net pay, for my Windows Form App don't show up. Please help me fix it so that the outputs show up.
Question: Write a Windows Forms application that

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!