This program calculates the total cost of a sandwich order. It defines variables for small and large sandwich sizes and sandwich toppings like lettuce, onion, and cheese. When the radio buttons or checkboxes are checked, they set the corresponding variable to the topping price. The button click handler sums all the variables and displays the total order cost.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
28 views
Exercise 11
This program calculates the total cost of a sandwich order. It defines variables for small and large sandwich sizes and sandwich toppings like lettuce, onion, and cheese. When the radio buttons or checkboxes are checked, they set the corresponding variable to the topping price. The button click handler sums all the variables and displays the total order cost.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2
Exercise #11
Public Class Form1
Dim Lettuce As Double Dim Onion As Double Dim Tomato As Double Dim Cheese As Double Dim Mustard As Double Dim Mayonnaise As Double Dim Small As Double Dim Large As Double
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click Label2.Text = Small + Large + Lettuce + Onion + Tomato + Cheese + Mustard + Mayonnaise End Sub
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles RadioButton1.CheckedChanged RadioButton1.Checked = Small Small = 2.5 End Sub
Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles RadioButton2.CheckedChanged RadioButton2.Checked = Large Large = 4.0 End Sub
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CheckBox1.CheckedChanged CheckBox1.Checked = Lettuce Lettuce = 0.1 End Sub
Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CheckBox2.CheckedChanged CheckBox2.Checked = Onion Onion = 0.1 End Sub
Private Sub CheckBox3_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CheckBox3.CheckedChanged CheckBox3.Checked = Tomato Tomato = 0.25 End Sub
Private Sub CheckBox4_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CheckBox4.CheckedChanged CheckBox4.Checked = Cheese Cheese = 0.5 End Sub Private Sub CheckBox5_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox5.CheckedChanged CheckBox5.Checked = Mustard Mustard = 0 End Sub
Private Sub CheckBox6_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CheckBox6.CheckedChanged CheckBox6.Checked = Mayonnaise Mayonnaise = 0 End Sub End Class