Note that there are some explanatory texts on larger screens.

plurals
  1. POOutput label shows only part of what I want to display
    primarykey
    data
    text
    <p>I have this program that I am working on for class, I think the problem is in my if statements. When I run the program and make my selection and click the total button and I get this as a display "for your appetizer, for your entree, and for dessert" in the order label and the price for the steak dinner in the order total label. I think I may have to use switch statements, but I'm not sure any suggestions would be of great help, thanks.</p> <pre><code> namespace Restaurant { public partial class frmRestaurant : Form { decimal AppetizerPrice = 0.0m; decimal EntreePrice = 0.0m; decimal DessertPrice = 0.0m; decimal total = 0.0m; string AppetizerOrder = "", EntreeOrder = "", DessertOrder = "", order = ""; public frmRestaurant() { InitializeComponent(); } private void exitToolStripMenuItem_Click(object sender, EventArgs e) { Application.Exit(); } private void btnTotal_Click(object sender, EventArgs e) { CalculateTotal(); Order(); lblOrder.Text = order; lblTotal.Text = total.ToString(); } private void grpAppetizer_Enter(object sender, EventArgs e) { if (radCheeseSticks.Checked) { AppetizerPrice = 5.99m; AppetizerOrder = "Cheese Sticks"; } else if (radGarlicBread.Checked) { AppetizerPrice = 4.50m; AppetizerOrder = "Garlic Bread"; } else if (radChipsnSalsa.Checked) { AppetizerPrice = 3.50m; AppetizerOrder = "Chips and Salsa"; } } private void grpEntree_Enter(object sender, EventArgs e) { if (radSteakDinner.Checked) { EntreePrice = 12.50m; EntreeOrder = "Steak Dinner"; } else if (radChickenParm.Checked) { EntreePrice = 10.99m; EntreeOrder = "Chicken Parmigiana"; } else if (radChipsnSalsa.Checked) { EntreePrice = 3.50m; EntreeOrder = "Chips and Salsa"; } } private void grpDessert_Enter(object sender, EventArgs e) { if (radSteakDinner.Checked) { DessertPrice = 12.50m; DessertOrder = "Steak Dinner"; } else if (radChickenParm.Checked) { DessertPrice = 10.99m; DessertOrder = "Chicken Parmigiana"; } else if (radChipsnSalsa.Checked) { DessertPrice = 3.50m; DessertOrder = "Chips and Salsa"; } } public decimal CalculateTotal() { total = AppetizerPrice + EntreePrice + DessertPrice; return total; } public string Order() { order = AppetizerOrder + "for your appetizer," + EntreeOrder + "for your entree, and " + DessertOrder + "for dessert"; return order; } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload