Write a program to place an order from the restaurant menu below. Create the for
ID: 3546985 • Letter: W
Question
Write a program to place an order from the restaurant menu below. Create the form and write the program so that after the button is clicked, the cost of the meal is calculated. The user must choose a Burger, but does not have to choose Fries and/or a Drink. Your program must deal with the possibility that the user does not choose one or both. It must also contain a "Reset Form" button that resets all the radio buttons on the form so that none of them are selected and clears any text in the textbox.
my code:
Public Class frmMenu
?
Private Sub grpChoiceBurgers_Enter(sender As Object, e As EventArgs) Handles grpChoiceBurgers.Enter
If grpChoiceBurgers.Enabled Then
?
grpFries.Enabled = True
grpChoiceDrink.Enabled = True
End If
?
End Sub
Private Sub grpFries_Enter(sender As Object, e As EventArgs) Handles grpFries.Enter
If grpFries.Enabled = True Then
grpChoiceDrink.Enabled = False
End If
End Sub
Private Sub grpChoiceDrink_Enter(sender As Object, e As EventArgs) Handles grpChoiceDrink.Enter
If grpChoiceDrink.Enabled = True Then
grpFries.Enabled = False
End If
End Sub
PS. no Checkboxes are to be used in this assignment only radiobuttons.
http://kursinfo.himolde.no/in-kurs/IBE150/h11/oblig3.pdf > Page 6 of PDF.
(
Explanation / Answer
For entire code i pasted here check : http://pastebin.com/6ftT8L77
else i posted code in parts i.e 3 parts please check
PART-1
HIEEE POSTED THE CODE IN 3 PARTS .. CHECK IT .. WORKING TOO GOOD ,,, DUE TO CHARACTER LIMITATION I POSTED SO ...
You need to use panels rather than group boxes here if that in fact is what grpChoiceBurgers, grpFries etc are.
I've done this very quickly and so didn't have time to give the radiobuttons, labels and the (very small) panels used to produce square symbols sensible names but I've included the designer code so you can see what names I've actually used.
Public Class frmMenu
Private Sub btnCompute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCompute.Click
If Not RadioButton1.Checked AndAlso Not RadioButton2.Checked AndAlso Not RadioButton3.Checked AndAlso Not RadioButton4.Checked Then
MessageBox.Show("You must choose a burger")
Return
End If
Dim cost As Decimal = 0
If RadioButton1.Checked Then
cost = 4.19
ElseIf RadioButton2.Checked OrElse RadioButton3.Checked Then
cost = 4.79
Else
cost = 5.39
End If
If RadioButton5.Checked Then
cost += 2.39
ElseIf RadioButton6.Checked Then
cost += 3.09
ElseIf RadioButton7.Checked Then
cost += 4.99
End If
If RadioButton8.Checked Then
cost += 1.69
ElseIf RadioButton9.Checked Then
cost += 1.49
End If
txtCost.Text = cost.ToString("F2")
End Sub
Private Sub btnReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReset.Click
RadioButton1.Checked = False
RadioButton2.Checked = False
RadioButton3.Checked = False
RadioButton4.Checked = False
RadioButton5.Checked = False
RadioButton6.Checked = False
RadioButton7.Checked = False
RadioButton8.Checked = False
RadioButton9.Checked = False
txtCost.Text = ""
End Sub
End Class
' designer code
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class frmMenu
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.Panel1 = New System.Windows.Forms.Panel()
Me.Panel2 = New System.Windows.Forms.Panel()
Me.Panel3 = New System.Windows.Forms.Panel()
Me.Label1 = New System.Windows.Forms.Label()
Me.Label2 = New System.Windows.Forms.Label()
Me.Label3 = New System.Windows.Forms.Label()
Me.pnlBurgers = New System.Windows.Forms.Panel()
Me.RadioButton1 = New System.Windows.Forms.RadioButton()
Me.RadioButton2 = New System.Windows.Forms.RadioButton()
Me.RadioButton3 = New System.Windows.Forms.RadioButton()
Me.RadioButton4 = New System.Windows.Forms.RadioButton()
Me.pnlFries = New System.Windows.Forms.Panel()
Me.RadioButton5 = New System.Windows.Forms.RadioButton()
Me.RadioButton6 = New System.Windows.Forms.RadioButton()
Me.RadioButton7 = New System.Windows.Forms.RadioButton()
Me.pnlDrinks = New System.Windows.Forms.Panel()
Me.RadioButton8 = New System.Windows.Forms.RadioButton()
Me.RadioButton9 = New System.Windows.Forms.RadioButton()
Me.Label4 = New System.Windows.Forms.Label()
Me.txtCost = New System.Windows.Forms.TextBox()
Me.btnCompute = New System.Windows.Forms.Button()
Me.btnReset = New System.Windows.Forms.Button()
Me.Label5 = New System.Windows.Forms.Label()
Me.Label6 = New System.Windows.Forms.Label()
Me.Label7 = New System.Windows.Forms.Label()
Me.pnlBurgers.SuspendLayout()
Me.pnlFries.SuspendLayout()
Me.pnlDrinks.SuspendLayout()
Me.SuspendLayout()
'
'Panel1
'
Me.Panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.Panel1.Location = New System.Drawing.Point(21, 69)
Me.Panel1.Name = "Panel1"
Me.Panel1.Size = New System.Drawing.Size(14, 15)
Me.Panel1.TabIndex = 0
'
'Panel2
'
Me.Panel2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.Panel2.Location = New System.Drawing.Point(21, 257)
Me.Panel2.Name = "Panel2"
Me.Panel2.Size = New System.Drawing.Size(14, 15)
Me.Panel2.TabIndex = 1
'
'Panel3
'
Me.Panel3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.Panel3.Location = New System.Drawing.Point(21, 367)
Me.Panel3.Name = "Panel3"
Me.Panel3.Size = New System.Drawing.Size(14, 15)
Me.Panel3.TabIndex = 2
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.