Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // get the index for the PGS and PRpO and if they are selected then deduct $2
- var pepperoni = toppingsCheckBoxList.Items.FindByText("Pepperoni (+$1.50)");
- var greenPepper = toppingsCheckBoxList.Items.FindByText("Green Peppers (+$0.50)");
- var sausage = toppingsCheckBoxList.Items.FindByText("Sausage (+$1.00)");
- var redPepper = toppingsCheckBoxList.Items.FindByText("Red Peppers(+$0.75)");
- var onion = toppingsCheckBoxList.Items.FindByText("Onion (+$0.75)");
- try
- {
- if ((pepperoni.Selected &&
- greenPepper.Selected &&
- sausage.Selected) ||
- (pepperoni.Selected &&
- redPepper.Selected &&
- onion.Selected))
- totalCost -= 2.00;
- // return the total
- totalPrice = string.Format("Total: {0:C2}", totalCost);
- }
- catch(NullReferenceException nre)
- {
- totalPrice = string.Format("Error: {0}<br/>{1}", nre.Message, nre.InnerException);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement