using Visual Studio what is the form1.designer.cs code used for this type of form1.cs code: the salad ordering application in C# using Visual Studio: using System; using System.Windows.Forms; namespace SaladOrderingApplication { public partial class Form1 : Form { private double totalPrice = 0; private double lettucePrice = 2.5; private double tomatoPrice = 1.5; private double cucumberPrice = 2.0; private double carrotPrice = 1.0; private double ranchSourcePrice = 0.5; private double honeyMustardSourcePrice = 0.6; private double italianSourcePrice = 0.7; private double lowFatSourcePrice = 0.4; public Form1() { InitializeComponent(); } private void cbLettuce_CheckedChanged(object sender, EventArgs e) { if (cbLettuce.Checked) { totalPrice += lettucePrice; lbIngredients.Items.Add("Lettuce"); } else { totalPrice -= lettucePrice; lbIngredients.Items.Remove("Lettuce"); } } private void cbTomato_CheckedChanged(object sender, EventArgs e) { if (cbTomato.Checked) { totalPrice += tomatoPrice; lbIngredients.Items.Add("Tomato"); } else { totalPrice -= tomatoPrice; lbIngredients.Items.Remove("Tomato"); } } private void cbCucumber_CheckedChanged(object sender, EventArgs e) { if (cbCucumber.Checked) { totalPrice += cucumberPrice; lbIngredients.Items.Add("Cucumber"); } else { totalPrice -= cucumberPrice; lbIngredients.Items.Remove("Cucumber"); } } private void cbCarrot_CheckedChanged(object sender, EventArgs e) { if (cbCarrot.Checked) { totalPrice += carrotPrice; lbIngredients.Items.Add("Carrot"); } else { totalPrice -= carrotPrice; lbIngredients.Items.Remove("Carrot"); } } private void rbRanch_CheckedChanged(object sender, EventArgs e) { if (rbRanch.Checked) { totalPrice += ranchSourcePrice; lbSources.Items.Clear(); lbSources.Items.Add("Ranch"); } else { totalPrice -= ranchSourcePrice; lbSources.Items.Clear(); } } private void rbHoneyMustard_CheckedChanged(object sender, EventArgs e) { if (rbHoneyMustard.Checked) { totalPrice += honeyMustardSourcePrice; lbSources.Items.Clear(); lbSources.Items.Add("Honey Mustard"); } else { totalPrice -= honeyMustardSourcePrice; lbSources.Items.Clear(); } private void rbItalian_CheckedChanged(object sender, EventArgs e) { if (rbItalian.Checked) { totalPrice += italianSourcePrice; lbSources.Items.Clear(); lbSources.Items.Add("Italian"); } else { totalPrice -= italianSourcePrice; lbSources.Items.Clear(); } } private void rbLowFat_CheckedChanged(object sender, EventArgs e) { if (rbLowFat.Checked) { totalPrice += lowFatSourcePrice; lbSources.Items.Clear(); lbSources.Items.Add("Low Fat"); } else { totalPrice -= lowFatSourcePrice; lbSources.Items.Clear(); } } private void btnOrder_Click(object sender, EventArgs e) { lbIngredients.Items.Clear(); lbSources.Items.Clear(); cbLettuce.Checked = false; cbTomato.Checked = false; cbCucumber.Checked = false; cbCarrot.Checked = false; rbRanch.Checked = false; rbHoneyMustard.Checked = false; rbItalian.Checked = false; rbLowFat.Checked = false; totalPrice = 0; MessageBox.Show("Your order has been placed!"); } private void btnClear_Click(object sender, EventArgs e) { lbIngredients.Items.Clear(); lbSources.Items.Clear(); cbLettuce.Checked = false; cbTomato.Checked = false; cbCucumber.Checked = false; cbCarrot.Checked = false; rbRanch.Checked = false; rbHoneyMustard.Checked = false; rbItalian.Checked = false; rbLowFat.Checked = false; totalPrice = 0; } private void btnDisplay_Click(object sender, EventArgs e) { MessageBox.Show("Ingredients: " + Environment.NewLine + String.Join(Environment.NewLine, lbIngredients.Items) + Environment.NewLine + Environment.NewLine + "Source: " + Environment.NewLine + String.Join(Environment.NewLine, lbSources.Items) + Environment.NewLine + Environment.NewLine + "Total Price: $" + totalPrice); } private void exitToolStripMenuItem_Click(object sender, EventArgs e) { Application.Exit(); } } }
using Visual Studio what is the form1.designer.cs code used for this type of form1.cs code:
the salad ordering application in C# using Visual Studio:
using System;
using System.Windows.Forms;
namespace SaladOrderingApplication
{
public partial class Form1 : Form
{
private double totalPrice = 0;
private double lettucePrice = 2.5;
private double tomatoPrice = 1.5;
private double cucumberPrice = 2.0;
private double carrotPrice = 1.0;
private double ranchSourcePrice = 0.5;
private double honeyMustardSourcePrice = 0.6;
private double italianSourcePrice = 0.7;
private double lowFatSourcePrice = 0.4;
public Form1()
{
InitializeComponent();
}
private void cbLettuce_CheckedChanged(object sender, EventArgs e)
{
if (cbLettuce.Checked)
{
totalPrice += lettucePrice;
lbIngredients.Items.Add("Lettuce");
}
else
{
totalPrice -= lettucePrice;
lbIngredients.Items.Remove("Lettuce");
}
}
private void cbTomato_CheckedChanged(object sender, EventArgs e)
{
if (cbTomato.Checked)
{
totalPrice += tomatoPrice;
lbIngredients.Items.Add("Tomato");
}
else
{
totalPrice -= tomatoPrice;
lbIngredients.Items.Remove("Tomato");
}
}
private void cbCucumber_CheckedChanged(object sender, EventArgs e)
{
if (cbCucumber.Checked)
{
totalPrice += cucumberPrice;
lbIngredients.Items.Add("Cucumber");
}
else
{
totalPrice -= cucumberPrice;
lbIngredients.Items.Remove("Cucumber");
}
}
private void cbCarrot_CheckedChanged(object sender, EventArgs e)
{
if (cbCarrot.Checked)
{
totalPrice += carrotPrice;
lbIngredients.Items.Add("Carrot");
}
else
{
totalPrice -= carrotPrice;
lbIngredients.Items.Remove("Carrot");
}
}
private void rbRanch_CheckedChanged(object sender, EventArgs e)
{
if (rbRanch.Checked)
{
totalPrice += ranchSourcePrice;
lbSources.Items.Clear();
lbSources.Items.Add("Ranch");
}
else
{
totalPrice -= ranchSourcePrice;
lbSources.Items.Clear();
}
}
private void rbHoneyMustard_CheckedChanged(object sender, EventArgs e)
{
if (rbHoneyMustard.Checked)
{
totalPrice += honeyMustardSourcePrice;
lbSources.Items.Clear();
lbSources.Items.Add("Honey Mustard");
}
else
{
totalPrice -= honeyMustardSourcePrice;
lbSources.Items.Clear();
}
private void rbItalian_CheckedChanged(object sender, EventArgs e)
{
if (rbItalian.Checked)
{
totalPrice += italianSourcePrice;
lbSources.Items.Clear();
lbSources.Items.Add("Italian");
}
else
{
totalPrice -= italianSourcePrice;
lbSources.Items.Clear();
}
}
private void rbLowFat_CheckedChanged(object sender, EventArgs e)
{
if (rbLowFat.Checked)
{
totalPrice += lowFatSourcePrice;
lbSources.Items.Clear();
lbSources.Items.Add("Low Fat");
}
else
{
totalPrice -= lowFatSourcePrice;
lbSources.Items.Clear();
}
}
private void btnOrder_Click(object sender, EventArgs e)
{
lbIngredients.Items.Clear();
lbSources.Items.Clear();
cbLettuce.Checked = false;
cbTomato.Checked = false;
cbCucumber.Checked = false;
cbCarrot.Checked = false;
rbRanch.Checked = false;
rbHoneyMustard.Checked = false;
rbItalian.Checked = false;
rbLowFat.Checked = false;
totalPrice = 0;
MessageBox.Show("Your order has been placed!");
}
private void btnClear_Click(object sender, EventArgs e)
{
lbIngredients.Items.Clear();
lbSources.Items.Clear();
cbLettuce.Checked = false;
cbTomato.Checked = false;
cbCucumber.Checked = false;
cbCarrot.Checked = false;
rbRanch.Checked = false;
rbHoneyMustard.Checked = false;
rbItalian.Checked = false;
rbLowFat.Checked = false;
totalPrice = 0;
}
private void btnDisplay_Click(object sender, EventArgs e)
{
MessageBox.Show("Ingredients: " + Environment.NewLine + String.Join(Environment.NewLine, lbIngredients.Items) +
Environment.NewLine + Environment.NewLine + "Source: " + Environment.NewLine + String.Join(Environment.NewLine, lbSources.Items) +
Environment.NewLine + Environment.NewLine + "Total Price: $" + totalPrice);
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit();
}
}
}
Step by step
Solved in 3 steps