The subtotal should be equal to 9500, and not 9000. I have the code to add a price to a hashset list, but when I click the compute button it's only getting one integer instead of adding them all.
private void computeButton_Click(object sender, EventArgs e)
{
double soloPrice = 0.00;
string selling = Convert.ToString(applianceList.SelectedItem);
HashSet<double> subTotalPrice = new HashSet<double>(15);
foreach (string price in itemTag.Items)
{
if (selling == "Electric Fan" && !subTotalPrice.Contains(500.00))
{
subTotalPrice.Add(500.00 * Convert.ToDouble(itemsNumber.Value));
soloPrice = 500.00 * Convert.ToDouble(itemsNumber.Value);
}
else if (selling == "Refrigerator" && !subTotalPrice.Contains(9000.00))
{
subTotalPrice.Add(9000.00 * Convert.ToDouble(itemsNumber.Value));
soloPrice = 9000.00 * Convert.ToDouble(itemsNumber.Value);
}
itemPrice.Text = "₱" + soloPrice;
subTotal.Text = "₱ " + subTotalPrice.Sum();
}