SlideShare a Scribd company logo
1 of 2
Page 1
Add to order button
private void addToOrderButton_Click(object sender, EventArgs e) {
// Add the current item price and quantity to the order.
if (noSizeRadioButton.Checked) {
MessageBox.Show("You must select a drink and size.",
"Missing required entry"); }
else {
try {
int quantityInteger = int.Parse(quantityTextBox.Text);
if (quantityInteger > 0) {
drinksInteger += quantityInteger;
totalOrderDecimal += drinkDecimal * quantityInteger;
clearForNextItem();
orderCompleteButton.Enabled = true; }
else {
MessageBox.Show("Please enter a quantity",
"Missing Required Entry"); } }
catch (FormatException) {
MessageBox.Show("Invalid Quantity", "Data Entry Error");
quantityTextBox.Focus();
quantityTextBox.SelectAll(); } } }
Order Complete
private void orderCompletebutton_Click(object sender, EventArgs e)
{
// Order is complete, add to summary and clear order.
// Check if the last item was added to the total.
if (itemPriceTextBox.Text != "")
{
DialogResult responseDialogResult;
string messageString = "Current item not recorded. Add to order?";
responseDialogResult = MessageBox.Show(messageString,
"Verify Last Drink Purchase", MessageBoxButtons.YesNo,
MessageBoxIcon.Question);
if (responseDialogResult == DialogResult.Yes)
{
addToOrderButton_Click(sender, e); } }
Page 2
// Display amount due.
string dueString = "Amount Due " + totalOrderDecimal.ToString("C");
MessageBox.Show(dueString, "Order Complete");
// Add to summary totals.
ordersInteger++;
totalSalesDecimal += totalOrderDecimal;
// Reset all for new order.
summaryButton.Enabled = true;
summaryToolStripMenuItem.Enabled = true;
orderCompleteButton.Enabled = false;
orderCompleteToolStripMenuItem.Enabled = false;
totalOrderDecimal = 0m;
}
Summary Button
private void summaryButton_Click(object sender, EventArgs e)
{
// Display the summary information in a message box.
string summaryString = "Drinks Sold: " + drinksInteger.ToString()
+ "nn" + "Number of Orders: " + ordersInteger.ToString()
+ "nn" + "Total Sales: " + totalSalesDecimal.ToString("C");
MessageBox.Show(summaryString, "Juice Bar Sales Summary",
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void exitButton_Click(object sender, EventArgs e)
{
// End the application.
this.Close();
}
Twelve Ounce Radio Button
private void twelveOunceRadioButton_CheckedChanged(object sender, EventArgs e)
{
// Calculate and display the price for the selected item.
// Handles all check boxes and radio buttons.
// Cast the sender to a RadioButton type.
RadioButton selectedSizeRadioButton = (RadioButton)sender;
switch (selectedSizeRadioButton.Name)
Page 3
{
case "twelveOunceRadioButton":
itemSizeDecimal = 3m;
break;
case "sixteenOunceRadioButton":
itemSizeDecimal = 3.5m;
break;
case "twentyOunceRadioButton":
itemSizeDecimal = 4m;
break;
}
drinkDecimal = itemSizeDecimal + findExtrasPrice();
itemPriceTextBox.Text = drinkDecimal.ToString("C");
}
private void clearForNextItem()
{
// Clear radio buttons, check boxes, text boxes.
noSizeRadioButton.Checked = true;
fruitJuiceRadioButton.Checked = true;
vitaminPackCheckBox.Checked = false;
energyBoosterCheckBox.Checked = false;
ladiesCheckBox.Checked = false;
itemPriceTextBox.Clear();
quantityTextBox.Text = "1";
}
private decimal findExtrasPrice()
{
// Find price for additives.
decimal extrasDecimal = 0m;
if (vitaminPackCheckBox.Checked)
extrasDecimal += .5m;
if (energyBoosterCheckBox.Checked)
extrasDecimal += .5m;
if (ladiesCheckBox.Checked)
extrasDecimal += .5m;
return extrasDecimal;
}
private void vitaminPackCheckBox_CheckedChanged(object sender, EventArgs e)
Page 4
{
// Check price of additives and display current price.
// Handles all three check boxes.
drinkDecimal = itemSizeDecimal + findExtrasPrice();
itemPriceTextBox.Text = drinkDecimal.ToString("C");
}
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
{
// Display information in a message box.
string aboutString = "Programmed by A. ProgrammernVersion 1.1";
string captionString =
"About Look Sharp Fitness Center Juice Bar Orders";
MessageBox.Show(aboutString, captionString);
}
private void fontToolStripMenuItem_Click(object sender, EventArgs e)
{
// Change the label’s font.
// Initialize the dialog box.
fontDialog1.Font = titleLabel.Font;
// Display the dialog box.
fontDialog1.ShowDialog();
// Assign the new font.
titleLabel.Font = fontDialog1.Font;
}
private void colorToolStripMenuItem_Click(object sender, EventArgs e)
{
// Change the form’s ForeColor.
// Applies to all controls on the form that haven’t had their
// ForeColor explicitly modified.
// Initialize the dialog box.
colorDialog1.Color = this.ForeColor;
// Display the dialog box.
colorDialog1.ShowDialog();
// Assign the new color.
this.ForeColor = colorDialog1.Color;
}
}
}

More Related Content

Similar to Codes.docx

Write a program that mimics the operations of several vending machin.pdf
Write a program that mimics the operations of several vending machin.pdfWrite a program that mimics the operations of several vending machin.pdf
Write a program that mimics the operations of several vending machin.pdf
eyebolloptics
 
help me Java projectI put problem and my own code in the linkmy .pdf
help me Java projectI put problem and my own code in the linkmy .pdfhelp me Java projectI put problem and my own code in the linkmy .pdf
help me Java projectI put problem and my own code in the linkmy .pdf
arihantmum
 
Programming a guide gui
Programming a guide guiProgramming a guide gui
Programming a guide gui
Mahmoud Hikmet
 
Basic calculator tutorial
Basic calculator tutorialBasic calculator tutorial
Basic calculator tutorial
Gilkye
 
Java ProgrammingImplement an auction application with the followin.pdf
Java ProgrammingImplement an auction application with the followin.pdfJava ProgrammingImplement an auction application with the followin.pdf
Java ProgrammingImplement an auction application with the followin.pdf
atulkapoor33
 
C# Program. Create a Windows application that has the functionality .pdf
C# Program. Create a Windows application that has the functionality .pdfC# Program. Create a Windows application that has the functionality .pdf
C# Program. Create a Windows application that has the functionality .pdf
fathimalinks
 
Hello everyone,Im actually working on a fast food order program..pdf
Hello everyone,Im actually working on a fast food order program..pdfHello everyone,Im actually working on a fast food order program..pdf
Hello everyone,Im actually working on a fast food order program..pdf
fedosys
 
VisualBasicExample
VisualBasicExampleVisualBasicExample
VisualBasicExample
Bo Dake
 

Similar to Codes.docx (20)

I can't get my code below to work with Option Strict On due to this part of t...
I can't get my code below to work with Option Strict On due to this part of t...I can't get my code below to work with Option Strict On due to this part of t...
I can't get my code below to work with Option Strict On due to this part of t...
 
Linear Search Program in Visual Basic 2008
Linear Search Program in Visual Basic 2008Linear Search Program in Visual Basic 2008
Linear Search Program in Visual Basic 2008
 
Membuat aplikasi penjualan buku sederhana
Membuat aplikasi penjualan buku sederhanaMembuat aplikasi penjualan buku sederhana
Membuat aplikasi penjualan buku sederhana
 
VB net lab.pdf
VB net lab.pdfVB net lab.pdf
VB net lab.pdf
 
Write a program that mimics the operations of several vending machin.pdf
Write a program that mimics the operations of several vending machin.pdfWrite a program that mimics the operations of several vending machin.pdf
Write a program that mimics the operations of several vending machin.pdf
 
C# labprograms
C# labprogramsC# labprograms
C# labprograms
 
help me Java projectI put problem and my own code in the linkmy .pdf
help me Java projectI put problem and my own code in the linkmy .pdfhelp me Java projectI put problem and my own code in the linkmy .pdf
help me Java projectI put problem and my own code in the linkmy .pdf
 
4.7.14&17.7.14&23.6.15&10.9.15
4.7.14&17.7.14&23.6.15&10.9.154.7.14&17.7.14&23.6.15&10.9.15
4.7.14&17.7.14&23.6.15&10.9.15
 
Programming a guide gui
Programming a guide guiProgramming a guide gui
Programming a guide gui
 
Ensayo
EnsayoEnsayo
Ensayo
 
Basic calculator tutorial
Basic calculator tutorialBasic calculator tutorial
Basic calculator tutorial
 
Java ProgrammingImplement an auction application with the followin.pdf
Java ProgrammingImplement an auction application with the followin.pdfJava ProgrammingImplement an auction application with the followin.pdf
Java ProgrammingImplement an auction application with the followin.pdf
 
C# Program. Create a Windows application that has the functionality .pdf
C# Program. Create a Windows application that has the functionality .pdfC# Program. Create a Windows application that has the functionality .pdf
C# Program. Create a Windows application that has the functionality .pdf
 
Hello everyone,Im actually working on a fast food order program..pdf
Hello everyone,Im actually working on a fast food order program..pdfHello everyone,Im actually working on a fast food order program..pdf
Hello everyone,Im actually working on a fast food order program..pdf
 
Project: Call Center Management
Project: Call Center ManagementProject: Call Center Management
Project: Call Center Management
 
Creating an Uber Clone - Part III.pdf
Creating an Uber Clone - Part III.pdfCreating an Uber Clone - Part III.pdf
Creating an Uber Clone - Part III.pdf
 
Windows Forms For Beginners Part - 3
Windows Forms For Beginners Part - 3Windows Forms For Beginners Part - 3
Windows Forms For Beginners Part - 3
 
VisualBasicExample
VisualBasicExampleVisualBasicExample
VisualBasicExample
 
Burger doll order form
Burger doll order formBurger doll order form
Burger doll order form
 
Html,Css and Javascript Forms using different tags
Html,Css and Javascript Forms using different tagsHtml,Css and Javascript Forms using different tags
Html,Css and Javascript Forms using different tags
 

Recently uploaded

IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Recently uploaded (20)

Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

Codes.docx

  • 1. Page 1 Add to order button private void addToOrderButton_Click(object sender, EventArgs e) { // Add the current item price and quantity to the order. if (noSizeRadioButton.Checked) { MessageBox.Show("You must select a drink and size.", "Missing required entry"); } else { try { int quantityInteger = int.Parse(quantityTextBox.Text); if (quantityInteger > 0) { drinksInteger += quantityInteger; totalOrderDecimal += drinkDecimal * quantityInteger; clearForNextItem(); orderCompleteButton.Enabled = true; } else { MessageBox.Show("Please enter a quantity", "Missing Required Entry"); } } catch (FormatException) { MessageBox.Show("Invalid Quantity", "Data Entry Error"); quantityTextBox.Focus(); quantityTextBox.SelectAll(); } } } Order Complete private void orderCompletebutton_Click(object sender, EventArgs e) { // Order is complete, add to summary and clear order. // Check if the last item was added to the total. if (itemPriceTextBox.Text != "") { DialogResult responseDialogResult; string messageString = "Current item not recorded. Add to order?"; responseDialogResult = MessageBox.Show(messageString, "Verify Last Drink Purchase", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (responseDialogResult == DialogResult.Yes) { addToOrderButton_Click(sender, e); } } Page 2 // Display amount due. string dueString = "Amount Due " + totalOrderDecimal.ToString("C"); MessageBox.Show(dueString, "Order Complete"); // Add to summary totals. ordersInteger++; totalSalesDecimal += totalOrderDecimal; // Reset all for new order. summaryButton.Enabled = true; summaryToolStripMenuItem.Enabled = true; orderCompleteButton.Enabled = false; orderCompleteToolStripMenuItem.Enabled = false; totalOrderDecimal = 0m; } Summary Button private void summaryButton_Click(object sender, EventArgs e) { // Display the summary information in a message box. string summaryString = "Drinks Sold: " + drinksInteger.ToString() + "nn" + "Number of Orders: " + ordersInteger.ToString() + "nn" + "Total Sales: " + totalSalesDecimal.ToString("C"); MessageBox.Show(summaryString, "Juice Bar Sales Summary", MessageBoxButtons.OK, MessageBoxIcon.Information); } private void exitButton_Click(object sender, EventArgs e) { // End the application. this.Close(); } Twelve Ounce Radio Button private void twelveOunceRadioButton_CheckedChanged(object sender, EventArgs e) { // Calculate and display the price for the selected item. // Handles all check boxes and radio buttons. // Cast the sender to a RadioButton type. RadioButton selectedSizeRadioButton = (RadioButton)sender; switch (selectedSizeRadioButton.Name)
  • 2. Page 3 { case "twelveOunceRadioButton": itemSizeDecimal = 3m; break; case "sixteenOunceRadioButton": itemSizeDecimal = 3.5m; break; case "twentyOunceRadioButton": itemSizeDecimal = 4m; break; } drinkDecimal = itemSizeDecimal + findExtrasPrice(); itemPriceTextBox.Text = drinkDecimal.ToString("C"); } private void clearForNextItem() { // Clear radio buttons, check boxes, text boxes. noSizeRadioButton.Checked = true; fruitJuiceRadioButton.Checked = true; vitaminPackCheckBox.Checked = false; energyBoosterCheckBox.Checked = false; ladiesCheckBox.Checked = false; itemPriceTextBox.Clear(); quantityTextBox.Text = "1"; } private decimal findExtrasPrice() { // Find price for additives. decimal extrasDecimal = 0m; if (vitaminPackCheckBox.Checked) extrasDecimal += .5m; if (energyBoosterCheckBox.Checked) extrasDecimal += .5m; if (ladiesCheckBox.Checked) extrasDecimal += .5m; return extrasDecimal; } private void vitaminPackCheckBox_CheckedChanged(object sender, EventArgs e) Page 4 { // Check price of additives and display current price. // Handles all three check boxes. drinkDecimal = itemSizeDecimal + findExtrasPrice(); itemPriceTextBox.Text = drinkDecimal.ToString("C"); } private void aboutToolStripMenuItem_Click(object sender, EventArgs e) { // Display information in a message box. string aboutString = "Programmed by A. ProgrammernVersion 1.1"; string captionString = "About Look Sharp Fitness Center Juice Bar Orders"; MessageBox.Show(aboutString, captionString); } private void fontToolStripMenuItem_Click(object sender, EventArgs e) { // Change the label’s font. // Initialize the dialog box. fontDialog1.Font = titleLabel.Font; // Display the dialog box. fontDialog1.ShowDialog(); // Assign the new font. titleLabel.Font = fontDialog1.Font; } private void colorToolStripMenuItem_Click(object sender, EventArgs e) { // Change the form’s ForeColor. // Applies to all controls on the form that haven’t had their // ForeColor explicitly modified. // Initialize the dialog box. colorDialog1.Color = this.ForeColor; // Display the dialog box. colorDialog1.ShowDialog(); // Assign the new color. this.ForeColor = colorDialog1.Color; } } }