The total value calculated on my form is wrong. 10800 - 10417 * 0.20 = 76.6
is the correct value, but the response in my form is 8716.6
? What am I doing wrong here ?
My form total is 8716.60
, while the correct value as shown on my calculator is 76.6
.
public void wwtax()
{
double tax = 0;
double value = 0;
if (tax < 10417)
{
tax = Convert.ToInt32(label21.Text);//the 10800 value
label20.Text = "0";
}
if (tax > 10417)
{
tax = Convert.ToInt32(label21.Text);
value = tax - 10417 * 0.20;
}
if (tax >= 16777)
{
tax = Convert.ToDouble(label21.Text);
value = tax - 16777 * 0.25 + 1250.00;
}
if (tax >= 33333)
{
tax = Convert.ToDouble(label21.Text);
value = tax - 33333 * 0.30 + 5416.67;
}
if (tax >= 83333)
{
tax = Convert.ToDouble(label21.Text);
value = tax - 33333 * 0.32 + 201416.67;
}
if (tax > 153846)
{
tax = Convert.ToDouble(label21.Text);
value = tax - 153846 * 0.35 + 1001416.67;
}
label20.Text = value.ToString();
}