Q:

Write a GUI program namedPayrollGUI that prompts the user for a name, SocialSecurity number, hourly pay rate, and number of hours worked. In an attractive format,display all the input data as well as the following:

0

Write a GUI program namedPayrollGUI that prompts the user for a name, SocialSecurity 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
  • State withholding tax, defined as 5 percent of the gross pay
  • Net pay, defined as gross pay minus taxes

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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 WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button_result_Click(object sender, EventArgs e)
        {
            string name, ssn;
            double payrate, grosspay, fw, sw, np;
            int hours;
            name = T1.Text.ToString();
            ssn = T2.Text.ToString();
            payrate =Convert.ToDouble(T3.Text.ToString());
            hours = Int32.Parse(T4.Text.ToString());
            grosspay = payrate * hours;
            fw = 0.15 * grosspay;
            sw = 0.05 * grosspay;
            np = grosspay - (fw + sw);
            labelDisplay.Text = "name: " + name + "\n" + "ssn: " + ssn + "\n" + "pay rate: " + payrate + "\n" + "hours worked: " + hours + "\n" + "Gross pay: " + grosspay + "\n" + "federal withholding tax: " + fw + "\n" + "state withholding tax: " + sw + "\n" + "net pay=" + np + "\n";
        }
    }
}

screen shot:

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now