private void button1_Click(object sender, EventArgs e) { String Name = (txtName.Text); int HourlyWage; int SocialSecurtiy; int HoursWorked; double NetPay; double GrossPay; double Federal; double State; double Tax; HourlyWage = Convert.ToInt32(txtPayRate.Text); HoursWorked = Convert.ToInt32(txtHoursWorked.Text); SocialSecurtiy = Convert.ToInt32(txtSocial.Text); GrossPay = HourlyWage * HoursWorked; State = GrossPay / 5; Federal = GrossPay / 15; Tax = State + Federal; NetPay = GrossPay - Tax; lblGrossPay.Text = "" + GrossPay.ToString("C"); lblFederal.Text = "" + Federal.ToString("C"); lblState.Text = "" + State.ToString("C"); lblNet.Text = "" + NetPay.ToString("C"); }
private void btnPayRoll_Click(object sender, EventArgs e) { String Name = (txtName.Text); int Security; int HourlyPay; int HoursWorked; double NetPay; double State; double Federal; double GrossPay; double Tax; HourlyPay = Convert.ToInt32(txtHourlyPay.Text); HoursWorked = Convert.ToInt32(txtHoursWorked.Text); Security = Convert.ToInt32(txtSocialSecurity.Text); GrossPay = HourlyPay * HoursWorked; Federal = GrossPay / 15; State = GrossPay / 5; Tax = Federal + State; NetPay = GrossPay - Tax; lblPayRoll.Text = "Hello " + Name + " Social Security( " + Security + ") , Gross Pay is " + GrossPay.ToString("c") + ". Federal is " + Federal.ToString("c") + " and State is " + State.ToString("c") + ".Your Net Pay is now " + NetPay.ToString("c"); }