SolvedC# Restaurant Bill Calculator Help

Posts 16 of 6 · Page 1 of 1
C# Restaurant Bill Calculator Help
Ok, so I have this practice problem I don't know how to do. Here's what my UI looks like.



My problem is that I need to use variables to do this. So when I press calculate bill, it will use those variables to determine all the things on the left hand side. So the appetizer total, mains total, refreshments total, subtotal, tax and the final total.

I WILL REP WHOEVER HELPS ME BECAUSE THIS IS A VERY IMPORTANT ASSIGNMENT.
You could go about this by using If and Else statements.

Example
Code:
float appetizer = 0; // Assign it to zero

            if(radioButton1.Checked) { // Check if Soup radio is checked
                appetizer = 2.00f; // if true change value of appetizer
            }
            else if(radioButton2.Checked) {
                appetizer = 2.50f;
             }
Since you can't put a float into TextBox1.Text, you need to convert float to string

Code:
 textBox1.Text = appetizer.ToString();
I won't give out the rest since it is an assignment.
I am sure you can figure out the rest for yourself.

Bai
Quote Originally Posted by ERGaergaergaergaergearg View Post
You could go about this by using If and Else statements.

Example
Code:
float appetizer = 0; // Assign it to zero

            if(radioButton1.Checked) { // Check if Soup radio is checked
                appetizer = 2.00f; // if true change value of appetizer
            }
            else if(radioButton2.Checked) {
                appetizer = 2.50f;
             }
Since you can't put a float into TextBox1.Text, you need to convert float to string

Code:
 textBox1.Text = appetizer.ToString();
I won't give out the rest since it is an assignment.
I am sure you can figure out the rest for yourself.

Bai
Quote Originally Posted by Jim Morrison View Post
Added you on Skype, accept me and I'll help you out.
Thanks guys, but the replies took so long that I had to think my ass off till I got it right. I'll rep anyways.
Quote Originally Posted by ImMalkah View Post
Thanks guys, but the replies took so long that I had to think my ass off till I got it right. I'll rep anyways.
Thanks for the rep man!

Good luck with future projects

Bai
Added you on Skype, accept me and I'll help you out.
Good to see you got it right, if you ever need any future help add me on Skype.
Posts 16 of 6 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

Need help?