Write a program using at least four different controls for your GUI interface th
ID: 3691586 • Letter: W
Question
Write a program using at least four different controls for your GUI interface that prompts the user for the following information inputs. Be sure to use non-factual information to populate the fields: Name (First and Last name) Address (street, city, state, zip) Hourly pay rate Number of hours worked Ensure that the program displays the following in a grid control: All the input data Gross pay, defined as hourly pay rate times hours worked Federal withholding tax, defined as fifteen percent of the gross pay State withholding tax, defined as five percent of the gross pay Net pay, defined as gross pay minus taxes You may use the following format as reference to write the program. Save the program as Payroll.cs
Explanation / Answer
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Payroll
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
double rate,grp,tax,net;
int hrwork;
rate=Convert.ToDouble(dataGridView1.Rows[0].Cells["Column6"].Value);
hrwork = Convert.ToInt32(dataGridView1.Rows[0].Cells["Column7"].Value);
grp = rate * hrwork;
dataGridView1.Rows[0].Cells["Column8"].Value = grp;
tax = grp * 15 / 100;
dataGridView1.Rows[0].Cells["Column9"].Value = tax;
net = grp - tax;
dataGridView1.Rows[0].Cells["Column10"].Value = net;
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.