Alright I have 8-10 check boxes and radio buttons, and i need to sum up the double values that are assigned to them. The only problem is that I only want to check some of the boxes not all of them. If you could help me out that would be great. Also any pointers on my code will also help
double SpringMix = 2.00;
double Avocado = 1.50;
double Beans = 2.00;
double Cheese = 2.00;
double Tomato = 1.50;
double HoneyMustard = 2.00;
double Ranch = 2.00;
double Italian = 2.00;
double BlueCheese = 2.00;
double FoodCost;
I'm using if statements to see if the check boxes are checked. I need a way to add them all up depending on if they are checked.
public double TotalOrderCost()
{
if (cbSpringMix.Checked)
{
FoodCost + 2.00;
}
if (cbAvocado.Checked)
{
FoodCost + 1.50;
}
if (cbBeans.Checked)
{
FoodCost + 2.00;
}
if (cbCheese.Checked)
{
Aucun commentaire:
Enregistrer un commentaire