using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication2 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } string name; int employeeNumber; double hours; const double hourlyWage = 8.5; double gross; double tax; double insurance; double deduction; private void btnCompute_Click(object sender, EventArgs e) { if (txtName.Text == "") { MessageB.Text = ""; } else if (txtPNumber.Text.Length <= 8) { MessageB.Text = ""; } else if (txtHoursWork.Text == "") { MessageB.Text = ""; } else if (btnCompute.Text == "Compute") { name = txtName.Text; employeeNumber = Convert.ToInt32(txtPNumber); hours = Convert.ToDouble(txtHoursWork.Text); gross = hours * hourlyWage; txtGrossPay.Text = "£" + Convert.ToString(gross); tax = gross / 100 * 20; txtIncomeTax = "£" + Convert.ToString(tax); insurance = gross / 100 * 7; txtNI = "£" + Convert.ToString(insurance); deduction = tax + insurance; txtTotalDeduction = "£" + Convert.ToString(deduction); } else { txtName.Text = ""; txtPNumber.Text = ""; txtHoursWork.Text = ""; txtGrossPay.Text = ""; txtIncomeTax.Text = ""; txtNI.Text = ""; txtTotalDeduction.Text = ""; } } private void button1_Click(object sender, EventArgs e) { Close(); } } }