My code is not returning the correct value
<p>I am trying to program a Form Pay Estimator and it calculates the gross pay, taxes owed, and net pay for an individual employee.  For some reason my CalculateTaxes method in my Pay() class is not returning the correct value. This is the code I have here:</p>

<p>In my Pay() class:</p>

<pre><code>{
        //declare variables
        private static int dependants;
        private static double grossPay;

        //property that gets and sets the dependants
        public int NumOfDependents
        {
            get
            {
                return dependants;
            }
            set
            {
                dependants = value;
            }
        }

    //calculates the gross pay for the production worker employee, using their hours
    //worked times their wage and overtime is calculated for the employee, if 
    //applicable
    public double CalculateGrossPay(double hoursWorked, double wageRate)
    {
        grossPay = hoursWorked * wageRate;
            if (hoursWorked &gt; 40)
            {
                grossPay += (.5 * wageRate) * (hoursWorked - 40);
            }
            return grossPay;
    }

    //calculates the gross pay for a salesperson, using their hours worked times their
    //wage rate and then commission is calculated for the employee, based on their 
    //sales amount
    public double CalculateGrossPay(double hoursWorked, double wageRate, double       salesAmount)
    {
        grossPay = hoursWorked * wageRate;
        if (salesAmount &lt;= 10000)
        {
            grossPay += .02 * salesAmount;
        }
        else if (salesAmount &gt; 10000)
        {
            grossPay += .04 * salesAmount;
        }
        return grossPay;
    }

    //calculates the taxes the employee has to pay
    public static double CalculateTaxes()
    {
        int payCutoff = 100 + (100 * dependants);

        if (grossPay &lt;= payCutoff)
        {
            double taxesPaid = .1 * grossPay;
            return taxesPaid;
        }
        else
        {
            double taxesPaid = (.1 * payCutoff) + (.2 * (grossPay - payCutoff));
            return taxesPaid;
        }
    }
}
</code></pre>

<p>And in my Form class:</p>

<pre><code>{
    public FormPayEstimator()
    {
        InitializeComponent();
    }

    //closes the application
    private void exitToolStripMenuItem_Click(object sender, EventArgs e)
    {
        Application.Exit();
    }

    //closes the application
    private void buttonExit_Click(object sender, EventArgs e)
    {
        Application.Exit();
    }

    //clears all text boxes, unchecks the salesperson check box, makes the sales amount
    //text box and label invisible and sets the focus back to the hours worked text box
    private void buttonClearForm_Click(object sender, EventArgs e)
    {
        textBoxDependants.Text = "";
        textBoxGrossPay.Text = "";
        textBoxHourlyWageRate.Text = "";
        textBoxHoursWorked.Text = "";
        textBoxNetPay.Text = "";
        textBoxTaxes.Text = "";
        checkBoxSalesperson.Checked = false;
        textBoxSalesAmount.Visible = false;
        labelSalesAmount.Visible = false;
        textBoxHoursWorked.Focus();
    }

    //displays information about the program
    private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
    {
        MessageBox.Show("Pay Estimator - Version 1.0", "Pay Estimator", MessageBoxButtons.OK, MessageBoxIcon.Information);
    }

    //if the user checks the salesperson check box the sales amount text box and label
    //become visible to the user and it sets the focus to the sales amount text box
    private void checkBoxSalesperson_CheckedChanged(object sender, EventArgs e)
    {
        textBoxSalesAmount.Visible = true;
        labelSalesAmount.Visible = true;
        textBoxSalesAmount.Focus();
    }

    //displays the font dialog box and allows user to change their font
    private void fontToolStripMenuItem_Click(object sender, EventArgs e)
    {
        fontDialog1.Font = textBoxHoursWorked.Font;
        fontDialog1.Font = textBoxHourlyWageRate.Font;
        fontDialog1.Font = textBoxDependants.Font;
        fontDialog1.Font = textBoxGrossPay.Font;
        fontDialog1.Font = textBoxTaxes.Font;
        fontDialog1.Font = textBoxNetPay.Font;
        fontDialog1.Font = textBoxSalesAmount.Font;
        if (fontDialog1.ShowDialog() != DialogResult.Cancel)
        {
            textBoxHoursWorked.Font = fontDialog1.Font;
            textBoxHourlyWageRate.Font = fontDialog1.Font;
            textBoxDependants.Font = fontDialog1.Font;
            textBoxGrossPay.Font = fontDialog1.Font;
            textBoxTaxes.Font = fontDialog1.Font;
            textBoxNetPay.Font = fontDialog1.Font;
            textBoxSalesAmount.Font = fontDialog1.Font;
        }
    }

    //displays the color dialog box and allows user to change thei font color
    private void colorToolStripMenuItem_Click(object sender, EventArgs e)
    {
        colorDialog1.Color = textBoxHoursWorked.ForeColor;
        colorDialog1.Color = textBoxHourlyWageRate.ForeColor;
        colorDialog1.Color = textBoxDependants.ForeColor;
        colorDialog1.Color = textBoxGrossPay.ForeColor;
        colorDialog1.Color = textBoxTaxes.ForeColor;
        colorDialog1.Color = textBoxNetPay.ForeColor;
        colorDialog1.Color = textBoxSalesAmount.ForeColor;
        if (colorDialog1.ShowDialog() != DialogResult.Cancel)
        {
            textBoxHoursWorked.ForeColor = fontDialog1.Color;
            textBoxHourlyWageRate.ForeColor = fontDialog1.Color;
            textBoxDependants.ForeColor = fontDialog1.Color;
            textBoxGrossPay.ForeColor = fontDialog1.Color;
            textBoxTaxes.ForeColor = fontDialog1.Color;
            textBoxNetPay.ForeColor = fontDialog1.Color;
            textBoxSalesAmount.ForeColor = fontDialog1.Color;
        }
    }

    //calculates the users total gross pay, their taxes owed and their net pay
    private void buttonCompute_Click(object sender, EventArgs e)
    {
        //declares variables
        string inValue;
        double hours, rate, dependants, salesAmount, grossPay, taxes, netPay;

        //assigns variables to values user entered in the hours worked, hourly wage
        //rate and dependants text boxes
        inValue = textBoxHoursWorked.Text;
        hours = double.Parse(inValue);
        inValue = textBoxHourlyWageRate.Text;
        rate = double.Parse(inValue);
        inValue = textBoxDependants.Text;
        dependants = int.Parse(inValue);

        //creates an instance of the Pay class and runs the CalculateGrossPay method
        //for the production workers
        Pay p1 = new Pay();
        grossPay = p1.CalculateGrossPay(hours, rate);

        //checks to see if the sales amount checkbox is checked and if it is, a value
        //is assigned to the salesAmount text box, an instance of the pay class is 
        // createdand the CalculateGrossPay method for a salesperson is run
        if (checkBoxSalesperson.Checked == true)
        {
            inValue = textBoxSalesAmount.Text;
            salesAmount = double.Parse(inValue);
            Pay p2 = new Pay();
            grossPay = p2.CalculateGrossPay(hours, rate, salesAmount);
        }
        //displays the answer in the Gross Pay text box
        textBoxGrossPay.Text = String.Format("{0:c}", grossPay).ToString();

        //runs the CalculateTaxes method from the Pay class and displays the result in
        //the taxes text box
        taxes = Pay.CalculateTaxes();
        textBoxTaxes.Text = String.Format("{0:c}", taxes).ToString();

        //calculates the net pay for an employee and displays the result in the net pay
        //text box
        netPay = grossPay - taxes;
        textBoxNetPay.Text = String.Format("{0:c}", netPay).ToString();
    }
}
</code></pre>

<p>}</p>

<p>When I compute the values I got $70 for taxes when it is only meant to be $40.  Can anyone tell me why this is happening?</p>
