Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const double TaxRate = 0.0775;
- static double subtotal;
- static double tax;
- static double OrderTotal;
- private void radButtonHamburger_CheckedChanged(object sender, EventArgs e)
- {
- subtotal = 0.0;
- txtSubtotal.Clear();
- lblAddOnItems0.Text = "Lettuce, tomato, and onions";
- lblAddOnItems1.Text = "Ketchup, mustard, an mayo";
- lblAddOnItems2.Text = "French fries";
- grpBoxAddOnItems.Text = "Add-on items($.75/each)";
- /* add the extra items */
- if (chkBox0.Checked)
- subtotal += 0.75;
- if (chkBox1.Checked)
- subtotal += 0.75;
- if (chkBox2.Checked)
- subtotal += 0.75;
- subtotal += 6.95; // main course
- tax = (subtotal * TaxRate);
- OrderTotal = subtotal + tax;
- }
- private void radButtonPizza_CheckedChanged(object sender, EventArgs e)
- {
- subtotal = 0.0;
- txtSubtotal.Clear();
- lblAddOnItems0.Text = "Pepperoni";
- lblAddOnItems1.Text = "Sausage";
- lblAddOnItems2.Text = "Olives";
- grpBoxAddOnItems.Text = "Add-on items($.50/each)";
- /* add the extra items */
- if (chkBox0.Checked)
- subtotal += 0.50;
- if (chkBox1.Checked)
- subtotal += 0.50;
- if (chkBox2.Checked)
- subtotal += 0.50;
- subtotal += 5.95; // main course
- tax = (subtotal * TaxRate);
- OrderTotal = subtotal + tax;
- }
- private void radButtonSalad_CheckedChanged(object sender, EventArgs e)
- {
- subtotal = 0.0;
- txtSubtotal.Clear();
- lblAddOnItems0.Text = "Croutouns";
- lblAddOnItems1.Text = "Bacon bits";
- lblAddOnItems2.Text = "Bread sticks";
- grpBoxAddOnItems.Text = "Add-on items($.25/each)";
- /* add the extra items */
- if (chkBox0.Checked)
- subtotal += 0.25;
- if (chkBox1.Checked)
- subtotal += 0.25;
- if (chkBox2.Checked)
- subtotal += 0.25;
- subtotal += 4.95; // main course
- tax = (subtotal * TaxRate);
- OrderTotal = subtotal + tax;
- }
- private void btnPlaceOrder_Click(object sender, EventArgs e)
- {
- txtSubtotal.Text = subtotal.ToString("C2");
- txtTax.Text = tax.ToString("C2");
- txtOrderTotal.Text = OrderTotal.ToString("C2");
- }
- private void btnExit_Click(object sender, EventArgs e)
- {
- Application.Exit();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement