Answered Radio buttons and check boxes with math

jag250

Active member
Joined
Sep 16, 2020
Messages
28
Programming Experience
1-3
http://miscapstone.uncw.edu/316f20matthewsk/MIS316/MP1Bmatthewsk.aspx
This is the project I have to build
I have created the online of the page and 3/4 panels are functioning and my textboxes are good to go.
I need help trying to get the math portion done and the radio and checkbox buttons. if you check the sample site you can see what parts I am missing. I am going to continue doing what I can, but help or a general outline of what I am missing would be greatly appreciated.
Screenshot 2020-09-16 14.01.55.png

C#:
protected void Button1_Click(object sender, EventArgs e)
{
    //input variable
    string name = "";
    int numbagels = 0;

    //variables to labels
    name = txtName.Text;
    numbagels = Convert.ToInt32(txtNumofBagels.Text);

    lblOrderFor.Text = name;
    lblNumberofBagels.Text = numbagels.ToString();

    if (rbCarryOut.Checked == true)
    {
        lblOrderType.Text = "Carry Out";
        lblChargeTax.Text = "No";
    }
    else
    {
        lblOrderType.Text = "Dine In";
        lblChargeTax.Text = "Yes";
    }
    pnlCustomer.Visible = false;
    pnlDineorCarry.Visible = true;
}


protected void btnFinishOrder_Click(object sender, EventArgs e)
{
    pnlDineorCarry.Visible = false;
    pnlFinishOrder.Visible = true;

    //input variable
    string name = "";
    int numbagels = 0;

    name = txtName.Text;
    numbagels = Convert.ToInt32(txtNumofBagels.Text);
 
Last edited by a moderator:
Please post your code in code tags here instead of posting a screenshot of your code. Screenshots are hard to read on smaller devices, and it also makes it harder for any volunteers here who may way to help you, but you are now forcing them to have to re-type your code from scratch.
 
Please post your code in code tags here instead of posting a screenshot of your code. Screenshots are hard to read on smaller devices, and it also makes it harder for any volunteers here who may way to help you, but you are now forcing them to have to re-type your code from scratch.
I added the code. thank you for letting me know.

Please post your code in code tags here instead of posting a screenshot of your code. Screenshots are hard to read on smaller devices, and it also makes it harder for any volunteers here who may way to help you, but you are now forcing them to have to re-type your code from scratch.
Thank you for letting me know.
 
Just saying "here's a link, here's my code, tell me what to do" is not really adequate. It's up to you to explain EXACTLY what you're trying to achieve, how you're trying to achieve it and what happens when you try. Anything not related specifically to your problem is not relevant so we don't need to see it or spend time reading it. We shouldn't have to work out what the issue is first. You should tell us.
 
Just saying "here's a link, here's my code, tell me what to do" is not really adequate. It's up to you to explain EXACTLY what you're trying to achieve, how you're trying to achieve it and what happens when you try. Anything not related specifically to your problem is not relevant so we don't need to see it or spend time reading it. We shouldn't have to work out what the issue is first. You should tell us.
Ok, thank you. Sorry first time posting a question.
 
Thanks for doing that. it looks like you just posted part of your code. You really should provide us the rest of what you have.

Also, we are not a code writing service. We can guide you towards a solution if you have a specific problem, or we can give you feedback on your code, which is what you seem to be asking for in your original post.
 
Ok, thank you. Sorry first time posting a question.
No problem. As long as you address the issues we raise and avoid repeating mistakes, we'll be happy.
 
how do I edit?
You may not have permission to edit posts until you made a certain number of them. If it's available, the edit link will be near the bottom, left corner of a post. If it's not there, just add a new post with the new information. That's generally preferable for new information anyway, as we will all get notifications for new posts but not for edits. Generally only use edits for corrections or additions made very soon after the original submission. If you do edit a fairly old post, it's often good to add a new post to draw attention to it. Otherwise, people may never see it.
 
It's also important to note, you should not update your original (opening topic) once you posted it, and instead reply to it with any modifications you may have made meanwhile.

Ps. Welcome to the forums.

Now can you explain the problem you have instead of asking us to investigate it for you? Maybe we can help
 
the page should summarize the previous options (order type, name, and number of bagels) as well as a base price ($2) and whether the order will be taxed (this is based on the order type). The options that show will allow the user to select a bagel type (one selection: plain, wheat, or everything), if the bagel should be toasted, if they want cream cheese, and the type of payment (cash or credit with cash being the default). Each option comes with up-charges indicated beside the choices.
Type of bagel- Plain , Wheat($1.00) , Everything ($1.50) radio buttons -Plain is automatically selected
Additional options- Toasted($.50) Cream Cheese ($1.00) [Check boxes]
Tax 7% on dine in only
carry out no tax

I need to build a formula that combines the options of prices. there is $2.00 base fee. and tax if the user choose dine in

When the Finish order button is clicked, an order summary of the selected options and a Next Customer button should show. The Next Customer button should reset the page to its starting state.



C#:
protected void Button1_Click(object sender, EventArgs e)
{
    //input variable
    string name = "";
    int numbagels = 0;

    //variables to labels
    name = txtName.Text;
    numbagels = Convert.ToInt32(txtNumofBagels.Text);

    lblOrderFor.Text = name;
    lblNumberofBagels.Text = numbagels.ToString();

    if (rbCarryOut.Checked == true)
    {
        lblOrderType.Text = "Carry Out";
        lblChargeTax.Text = "No";
    }
    else
    {
        lblOrderType.Text = "Dine In";
        lblChargeTax.Text = "Yes";
    }
    pnlCustomer.Visible = false;
    pnlDineorCarry.Visible = true;
}


protected void btnFinishOrder_Click(object sender, EventArgs e)
{
    pnlDineorCarry.Visible = false;
    pnlFinishOrder.Visible = true;

    //input variable
    string name = "";
    int numbagels = 0;

    name = txtName.Text;
    numbagels = Convert.ToInt32(txtNumofBagels.Text);
[/QUOTE]
 
You have a choice for coming up with the total. You can think like a mathematician or an Excel jockey and try to combine everything into a single formula; or you can think like a programmer and break down the problem into a series of steps. I personally prefer the latter, but there are many who come into computers who come from the math track and would prefer the former.
 
I need to create a C# formula that adds a $2.00 base fee plus any add ons (listed below). one with a tax of 7% and one without

Type of bagel- Plain , Wheat($1.00) , Everything ($1.50) radio buttons -Plain is automatically selected
Additional options- Toasted($.50) Cream Cheese ($1.00) [Check boxes]
Tax 7% on dine in only
carry out no tax

I'm having trouble on where and how to start. I just need help getting started and then I am pretty sure I can go from there.
Thanks :)
 
I need more than that like a sample code if that's possible. With a try-catch I think. I just started learning C# 3 weeks ago so I need a little more explanation. Thank you.
 
Last edited by a moderator:
I need to create a C# formula that adds a $2.00 base fee plus any add ons (listed below). one with a tax of 7% (dine in) and one without (carry out)


Type of bagel- Plain [rbPlain] , Wheat($1.00) [rbWheat], Everything ($1.50) [rbEverything] -->radio buttons

-Plain is automatically selected-

Additional options- Toasted($.50) [cbToasted], Cream Cheese ($1.00) [cbCreamCheese] -->Check boxes

Tax 7% on dine in only

carry out no tax
need a subtotal and a Total


example:
Subtotal: $10.00 ($2.00 each) Tax: $0.00 --> this is carry out so no tax

Total due: $10.00
 

Latest posts

Back
Top Bottom