public override string ToString() { return(Id + " " + FirstName + " " + LastName + " " + GrossPay.ToString("C") + " " + FederalTax.ToString("C") + " " + StateTax.ToString("C") + " " + NetPay.ToString("C")); }
private void btnNetPay_Click(object sender, EventArgs e) { double Hours, Rate; double GrossPay, FederalTax, StateTax, NetPay; Hours = Convert.ToDouble(txtAmountWorked.Text); Rate = Convert.ToDouble(txtHourlyDailyMonthlyRate.Text); GrossPay = Hours * Rate; FederalTax = GrossPay * 0.15; StateTax = GrossPay * 5 / 100; NetPay = GrossPay - (FederalTax + StateTax); txtGrossPay.Text = GrossPay.ToString("c"); txtStateTax.Text = StateTax.ToString("c"); txtFederalTax.Text = FederalTax.ToString("c"); txtNetPay.Text = NetPay.ToString("c"); }
private void button1_Click(object sender, EventArgs e) { double hours, rate; double FederalTax, NetPay, StateTax, GrossPay; /* Console.Write("Please Enter the number of hours worked"); * String input = Console.ReadLine(); * double hours = double.Parse */ hours = Convert.ToDouble(textBox_HoursWorked.Text); rate = Convert.ToDouble(textBox_HourlyRate.Text); GrossPay = hours * rate; FederalTax = GrossPay * 0.15; StateTax = GrossPay * 0.05; NetPay = GrossPay - (FederalTax + StateTax); textBoxGrossPay.Text = GrossPay.ToString("C"); textBoxFedTax.Text = FederalTax.ToString("C"); textBoxStateTax.Text = StateTax.ToString("C"); textBoxNetPay.Text = NetPay.ToString("C"); }