Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7690637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:26:34+00:00 2026-05-31T20:26:34+00:00

I have this program that I am working on for class, I think the

  • 0

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.

 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;
    }
 }
 }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T20:26:36+00:00Added an answer on May 31, 2026 at 8:26 pm

    I think the GroupBox.Enter event is not useful for your use case. The enter event is invoked sometime during the control activation, but not when the value is changed.

    One way to fix your problem is to set the appetizer/entree/dessert price and text only when the “Total” button is clicked. You do not need it before that in the current form right now.

    Another way to fix it is to use the correct event: Just handle the RadioButton.CheckedChanged event for all of those radio buttons, for example:

    private void radGarlicBread_CheckedChanged(object sender, EventArgs e)
    {
        if (radGarlicBread.Checked)
        {
            AppetizerPrice = 4.50m;
            AppetizerOrder = "Garlic Bread";
        }   
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is my problem. I have a program that has to run in a
I have a program that looks something like this: public partial class It {
I have a program that simulates mouse click. Code is something like this: [DllImport(user32.dll,
Hi all I have this code that doesnt seem to be working. I think
trying to run this program. I think that to setup all of the web
I have this program that should execute a piece of code base on the
So I have this program that I really like, and it doesn't support Applescript.
I have a C/ncurses program that I'm debugging/maintaining. This program does ripoffline twice: first,
I have a program that generates a .shp file, and exports this as a
I have written a program that uses qhttp to get a webpage. This works

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.