Calculating sales tax in cashier program
<p>Why is sales tax not adding to the subtotal and total?</p>

<pre><code>    //Value from xQuantity
    double quantity = Convert.ToDouble(xQuantity.Text);

    //Value from xUnitPrice
    double unitPrice = Convert.ToDouble(xUnitPrice.Text);

    //Value from xSubTotal and xTotalPrice
    double SubTotal = quantity * unitPrice;
    xSubTotalTextBox.Text = Convert.ToString(subTotal);

    double Tax = subTotal * 1.06 + subTotal;
    xSubTotalTextBox.Text = Convert.ToString(subTotal);
    xTotalPrice.Text = Convert.ToString(totalPrice);

    //Calculate subtotal and totalprice
    subTotal = Convert.ToDouble(xQuantity.Text) * Convert.ToDouble(xUnitPrice.Text);
    xSubTotalTextBox.Text = subTotal.ToString();
    xTotalPrice.Text = (subTotal * Tax).ToString();         
}

private void xBalance_Click(object sender, EventArgs e)
{
    xRetTextBox.Visible = true;
    xReturn.Visible = true;

    double totalPrice = Convert.ToDouble(xTotalPrice.Text);
    double receive = Convert.ToDouble(xRecvTextBox.Text);
    double subTotal = totalPrice - receive;
    xRetTextBox.Text = Convert.ToString(totalPrice);

    if (totalPrice &lt; .01) xRetTextBox.BackColor = Color.Green;
    else xRetTextBox.BackColor = Color.Red;
}
</code></pre>
