create a project for R 'n R for reading 'n Refreshment that calculates the amount due for individual orders and maintains accumulated totals for a summary . have a check box for takeout items, which are taxable at 8 percent all other orders are nontaxable. Include radio buttons for the five coffee selections: Cappuccino, Espresso, Latte, Iced Cappuccino, and Iced Latte. The prices for each will be assigned using these constants: Cappu----2.00 Espresso---2.25 Latte--1.75 Iced (either)---2.50.
Visual Basic
Visual Basic Code
Public Class Form1
Dim cost1, cost2, total As Double ' Declare double variables
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
' Initialize constant cost=0,total=0
cost1 = 0
total = 0
' checkboxes is true then assign cost1 value
If CheckBox1.Checked = True Then
cost1 += 3
End If
If CheckBox2.Checked = True Then
cost1 += 2
End If
If CheckBox3.Checked = True Then
cost1 += 4
End If
If CheckBox4.Checked = True Then
cost1 += 6
End If
' radiobuttons is true then assign cost2 value
If RadioButton1.Checked = True Then
cost2 = 2.0
End If
If RadioButton2.Checked = True Then
cost2 = 2.25
End If
If RadioButton3.Checked = True Then
cost2 = 1.75
End If
If RadioButton4.Checked = True Or RadioButton5.Checked = True
Then
cost2 = 2.5
End If
'calculate total value
total = cost1 + (cost1 * 8 / 100) + cost2
TextBox1.Text = "$" & total 'display total cost
End Sub
End Class
OUTPUTS
create a project for R 'n R for reading 'n Refreshment that calculates the amount due...