Question
I need help fixing my code Please! These are the requirements for the program: This is the code that I have: using System; using System.Collections.Generic;
I need help fixing my code Please!
These are the requirements for the program:
This is the code that I have:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms;
namespace Lab10 { public partial class Form1 : Form { public Form1() { InitializeComponent(); }
private void button1_Click(object sender, EventArgs e) { double addon; double maincourse; double subtotal; double total; double tax;
if (radioButton1.Checked) { maincourse = 6.95; addon = 0.75; } else if (radioButton2.Checked) { maincourse = 5.95; addon = 0.5; } else if (radioButton3.Checked) { maincourse = 4.95; addon = 0.25; } subtotal = maincourse;
if (checkBox1.Checked = true)
subtotal = subtotal + addon; if else (checkBox2.Checked = true) subtotal = subtotal + addon if else (checkBox3.Checked = true) subtotal = subtotal + addon
tax = (7.75 / 100)*subtotal total = tax + subtotal
textBox1.Text = subtotal.ToString; textBox2.Text = tax.ToString("#.##"); textBox3.Text = total.ToString("#.##"); }
private void button2_Click(object sender, EventArgs e) { Application.Exit(); }
private void checkBox3_CheckedChanged(object sender, EventArgs e) { clearTotals();
}
private void checkBox2_CheckedChanged(object sender, EventArgs e) { clearTotals();
}
private void checkBox1_CheckedChanged(object sender, EventArgs e) { clearTotals(); }
private void radioButton1_CheckedChanged(object sender, EventArgs e) { groupBox1.Text = "Add-on Item($0.75 each)"; checkBox1.Text = "Lettuce, tomato and onion"; checkBox2.Text = "Ketchup, mustard and mayo"; checkBox3.Text = "French fries";
clearAddOns(); }
private void radioButton2_CheckedChanged(object sender, EventArgs e) { groupBox1.Text = "Add-on Item ($0.50 each)"; checkBox1.Text = "Peperoni"; checkBox2.Text = "Sauces"; checkBox3.Text = "Olives";
clearAddOns(); }
private void radioButton3_CheckedChanged(object sender, EventArgs e) { groupBox1.Text = "Add-on Item ($0.25 each)"; checkBox1.Text = "Croutons"; checkBox2.Text = "Bacon bits"; checkBox3.Text = "Bread sticks";
clearAddOns(); }
private void Form1_Load(object sender, EventArgs e) { groupBox1.Text = "Add-on Item($0.75 each)"; checkBox1.Text = "Lettuce, tomato and onion"; checkBox2.Text = "Ketchup, mustard and mayo"; checkBox3.Text = "French fries";
clearAddOns(); checkBox1.Checked = false; checkBox2.Checked = false; checkBox3.Checked = false;
clearTotals(); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = "";
} } }
C-Sharp University needs you to create a form that accepts a lunch order from the student and then calculates the order subtotal and total. Lunch Order Main course Add-on items (S.75/each) Hamburger- $6.95 Pizza -$5.95 Salad -$4.95 Lettuce, tomato, and onions Ketchup, mustard, and mayo French fres Order total Place Qrder Subtotal Tax (7.75%) Order total Exit The application should provide for these main courses and add-ons: Price 6.95 Add-on Lettuce, tomato, and onions Ketchup, mustard, and mayo French fries Add-on price .75 Main course Hamburger Pizza 5.95 .50 Pepperoni Sausage Olives Salad Croutons Bacon bits Bread sticks 4.95 25Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started