This is one approach to solving your problem. First you will need to add some variables to your code, to keep track of the cost of your appetiser, beverage, main course and dessert. It would be a good idea to have a variable for the tax and the total as well. You should also define a const double for the tax rate. It is important to set these values to 0.0, except the tax rate which would be your tax rate.
csharp
const double taxRate = 0.08;
double beverage = 0.0;
double appe = 0.0;
double main = 0.0;
double dessert = 0.0;
double tax = 0.0;
double total = 0.0;
Now, in each of your methods that handle when the selected index is changed you would want to get the value of item and assign it to the appropriate vairable. Then, call a method that I will show you in a moment. Here is a sample method to do the above, for the beverage:
csharp
private void cbBeverage_SelectedIndexChanged(object sender, EventArgs e)
{
userInput selectedData = (userInput)cbBeverage.SelectedItem;
lblBeverage.Text = selectedData.Name + ":" + selectedData.Value;
beverage = selectedData.Value;
CalculateTotal();
}
You would do the exact same thing in the other methods but instead of using beverage you would use appe, main and dessert. Now, the method I was talking about will calculate the total of the order with the tax and assign it to a label on the form. I called the label on my form lblOrderTotal. This is what the CalculateTotal method looks like:
csharp
private void CalculateTotal()
{
total = beverage + appe + main + dessert;
tax = total * taxRate;
double orderTotal = total + tax;
lblOrderTotal.Text = orderTotal.ToString();
}
As you can see, this method takes each of the values and adds them together. Then it calculates the tax for the order. It adds the two together, converts it to a string and assigns it to the label.
If you can't get this to work on your own, leave a message and I will post the entire code for you.