Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write the program in C# ,please provide a screenshot for the code and output Exe

ID: 3711227 • Letter: W

Question

Write the program in C# ,please provide a screenshot for the code and output

Exercises chopter 3 GUI program named PayrollGUI that prompts the user for a name, Social Write a Security number, hourly pay rate, and number of hours worked. In an attractive format, display all the input data as well as the following: . Gross pay, defined as hourly pay rate times hours worked . Federal withholding tax, defined as 15 percent of the gross pay 135 State withholding tax, defined as 5 percent of the gross pay . Net pay, defined as gross pay minus taxes holds values for the months of the year,

Explanation / Answer

Hi Dear,

Please find my implemetation.

using System;
using System.Drawing;
using System.Windows.Forms;

public class Program {
public static void Main() {
Application.Run(new PayrollGui());
}
}
public class PayrollGui : Form {
private TextBox txtName, txtSSN, txtHourlyPay, txtHourWorked;
private Button btnProceed;
private Label lblResult;

public PayrollGui() {
InitialiseComponent();
}
private void InitialiseComponent() {
txtName = new TextBox();
txtName.Text = "name";
txtName.Location = new Point(10, 10);
Controls.Add(txtName);

txtSSN = new TextBox();
txtSSN.Text = "SSN";
txtSSN.Location = new Point(10, 40);
Controls.Add(txtSSN);

txtHourlyPay = new TextBox();
txtHourlyPay.Text = "100";
txtHourlyPay.Location = new Point(10, 70);
Controls.Add(txtHourlyPay);

txtHourWorked = new TextBox();
txtHourWorked.Text = "40";
txtHourWorked.Location = new Point(10, 100);
Controls.Add(txtHourWorked);

btnProceed = new Button();
btnProceed.Text = "Proceed";
btnProceed.Location = new Point(10, 130);
btnProceed.Click += new EventHandler(btnProceed_Click);
Controls.Add(btnProceed);

lblResult = new Label();
lblResult.Location = new Point(10, 170);
lblResult.Size = new Size(150, 60);
Controls.Add(lblResult);

Text = "Payroll";
}

private void btnProceed_Click(Object sender, EventArgs e) {
Report();
}

private void Report() {
double hourlyPay = GetAsDouble(txtHourlyPay);
double hourWorked = GetAsDouble(txtHourWorked);
double grossPay = PayrollService.GrossPay(hourlyPay, hourWorked);
double netPay = PayrollService.NetPay(grossPay);

string message = string.Format(
"Gross pay: {0:c} Federal tax: {1:c} State tax: {2:c} Net pay: {3:c}",
grossPay,
grossPay * PayrollService.TAX_WITHHELD_FEDERAL,
grossPay * PayrollService.TAX_WITHHELD_STATE,
netPay);

lblResult.Text = message;
}
private double GetAsDouble(TextBox txt) {
double result = 0;
Double.TryParse(txt.Text, out result);
return result;
}

public class PayrollService {
public static readonly double TAX_WITHHELD_FEDERAL = .15;
public static readonly double TAX_WITHHELD_STATE = 0.05;

public static double GrossPay(double rate, double worked) {
return rate * worked;
}

public static double NetPay(double pay) {
double result = pay;
result -= (pay * TAX_WITHHELD_FEDERAL);
result -= (pay * TAX_WITHHELD_STATE);
return result;
}