示例#1
0
        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");
        }
 public override string ToString()
 {
     return(Id + " "
            + FirstName + " "
            + LastName + " "
            + GrossPay.ToString("C") + " "
            + FederalTax.ToString("C") + " "
            + StateTax.ToString("C") + " "
            + NetPay.ToString("C"));
 }
示例#3
0
        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");
        }
示例#4
0
        private void BtnCalculateGrossPay_Click(object sender, EventArgs e)
        {
            //Declare Variables
            int    hoursWorked;
            double payRate, GrossPay;

            try
            {
                //Get input by the user
                hoursWorked = int.Parse(txtBoxHoursWorked.Text);
                payRate     = double.Parse(txtBoxPayRate.Text);

                //Calculate Gross Pay
                GrossPay = (hoursWorked * payRate);

                //Display gross pay message box
                MessageBox.Show("The gross pay is " + GrossPay.ToString("c"));
            } catch
            {
                MessageBox.Show("Please only enter numeric values");
            }
        }
示例#5
0
        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");
        }
示例#6
0
        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");
        }