玖何呷特惠套餐:
A.義式蕃茄義大利麵 298元
B.雲泰辣炒河粉 229元
C.墨魚海鮮焗麵 239元
D.烏骨雞湯煲飯 319元
E.韓式泡菜豬排拌鍋飯 359元
是否加點甜品?
A.草莓慕斯 +20元 (原價45元) B.黑森林蛋糕 +15元 (原價42元) C.法式千層派 +25元 (原價50元)
套餐點麵(A、C)甜品原價計算
飲料:+30元
A.薰衣草奶茶
B.薄荷清茶
C.拿鐵抹茶 +10元
D.曼特寧咖啡 +5元
若加點甜品,飲料可折抵10元
若甜品與飲料都未點,則不可折抵10元
1.可重覆點餐 (點菜機上需加上份數)
2.五人同行一人免費 (點菜機上需可輸入人數,點的套餐裡最便宜的免費,甜品飲料原價)
3.同一套餐第二人點,第二份可打9折(點的份數為偶數第二份才能打折)
4.消費滿2000元加送一道沙拉(每個人都有但只能單選一種:A.陽光沙拉、B.水果沙拉、C.洋芋沙拉)
ps 紅線表示 未完成的部分
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sun, drink, sweet, meal As Double
'若加點甜品,飲料可折抵10元
If TextBox6.Text >= 1 Or TextBox7.Text >= 1 Or TextBox8.Text >= 1 Then
drink = CInt(TextBox9.Text) * 20 + CInt(TextBox10.Text) * 20 + CInt(TextBox11.Text) * 30 + CInt(TextBox11.Text) * 25
Else
drink = CInt(TextBox9.Text) * 30 + CInt(TextBox10.Text) * 30 + CInt(TextBox11.Text) * 40 + CInt(TextBox11.Text) * 35
End If
'套餐 同一套餐第二人點,第二份可打9折(點的份數為偶數第二份才能打折)
If TextBox1.Text Mod 2 = 0 Or TextBox2.Text Mod 2 = 0 Or TextBox3.Text Mod 2 = 0 Or TextBox4.Text Mod 2 = 0 Or TextBox5.Text Mod 2 = 0 Then
meal = CInt(TextBox1.Text) * 298 * 0.9 + CInt(TextBox2.Text) * 229 * 0.9 + CInt(TextBox3.Text) * 239 * 0.9 + CInt(TextBox4.Text) * 319 * 0.9 + CInt(TextBox5.Text) * 359 * 0.9
Else
meal = CInt(TextBox1.Text) * 298 + CInt(TextBox2.Text) * 229 + CInt(TextBox3.Text) * 239 + CInt(TextBox4.Text) * 319 + CInt(TextBox5.Text) * 359
End If
' 套餐點麵(A、C)甜品原價計算
If TextBox1.Text >= 1 Or TextBox3.Text >= 1 Then
sweet = CInt(TextBox6.Text) * 45 + CInt(TextBox7.Text) * 42 + CInt(TextBox8.Text) * 50
Else
sweet = CInt(TextBox6.Text) * 20 + CInt(TextBox7.Text) * 15 + CInt(TextBox8.Text) * 25
End If
' 消費滿2000元加送一道沙拉(每個人都有但只能單選一種:A.陽光沙拉、B.水果沙拉、C.洋芋沙拉)
'總和
sun = meal + sweet + drink
Label14.Text = sun
If sun >= 2000 And TextBox13.Text >= 1 Then
MsgBox("消費滿兩千 送每人一道沙拉")
Form3.Show()
ElseIf sun <= 2000 And TextBox13.Text >= 1 Then
Else
MsgBox("請輸入人數")
Close()
End If
'如果點了套餐 自動跳出 甜點 and 人數>=1
If TextBox1.Text >= 1 Or TextBox2.Text >= 1 Or TextBox3.Text >= 1 Or TextBox4.Text >= 1 Or TextBox5.Text >= 1 Then
Form2.Show()
End If
''找錢
'Dim c_sun, small_money As Integer
'If c_sun > sun Then '當被除數大於等於除數進入迴圈
' c_sun = CInt(TextBox1.Text) '將客戶 文字 轉數值
' small_money = c_sun - sun
' Label16.Text = small_money
' small_money = small_money \ 500 '總金額\500元
' Label17.Text = small_money
'End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'套餐
TextBox1.Text = "0"
TextBox2.Text = "0"
TextBox3.Text = "0"
TextBox4.Text = "0"
TextBox5.Text = "0"
'甜點
TextBox6.Text = "0"
TextBox7.Text = "0"
TextBox8.Text = "0"
'飲料
TextBox9.Text = "0"
TextBox10.Text = "0"
TextBox11.Text = "0"
TextBox12.Text = "0"
TextBox13.Text = "0"
End Sub
'當滑鼠 點textbox時 clear
Private Sub TextBox1_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.Enter
TextBox1.Clear()
End Sub
Private Sub TextBox2Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox2.Enter
TextBox2.Clear()
End Sub
Private Sub TextBox3_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox3.Enter
TextBox3.Clear()
End Sub
Private Sub TextBox4_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox4.Enter
TextBox4.Clear()
End Sub
Private Sub TextBox5_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox5.Enter
TextBox5.Clear()
End Sub
End Class
Public Class Form2
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Close()
End Sub
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'A.草莓慕斯 +20元 (原價45元) B.黑森林蛋糕 +15元 (原價42元) C.法式千層派 +25元 (原價50元)
' 套餐點麵(A、C)甜品原價計算
Label1.Text = "草莓慕斯 +20元 (原價45元)"
Label2.Text = "黑森林蛋糕 +15元 (原價42元)"
Label3.Text = "法式千層派 +25元 (原價50元)"
TextBox1.Text = "0"
TextBox2.Text = "0"
TextBox3.Text = "0"
End Sub
'當點textbox時 clear
Private Sub TextBox1_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.Enter
TextBox1.Clear()
End Sub
Private Sub TextBox2_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox2.Enter
TextBox2.Clear()
End Sub
Private Sub TextBox3_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox3.Enter
TextBox3.Clear()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sun1 As Integer
If Form1.TextBox1.Text >= 1 Or Form1.TextBox3.Text >= 1 Then
sun1 = CInt(TextBox1.Text) * 45 + CInt(TextBox2.Text) * 42 + CInt(TextBox3.Text) * 50
Else
sun1 = CInt(TextBox1.Text) * 20 + CInt(TextBox2.Text) * 15 + CInt(TextBox3.Text) * 25
End If
Form1.TextBox6.Text += CInt(TextBox1.Text)
Form1.TextBox7.Text += CInt(TextBox2.Text)
Form1.TextBox8.Text += CInt(TextBox3.Text)
Form1.Label14.Text += sun1
MsgBox("已加入選單")
Close()
End Sub
End Class
Public Class Form3
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' 消費滿2000元加送一道沙拉(每個人都有但只能單選一種:A.陽光沙拉、B.水果沙拉、C.洋芋沙拉)
If RadioButton1.Checked = True Then
MsgBox("您點的是陽光沙拉")
Close()
ElseIf RadioButton2.Checked = True Then
MsgBox("您點的是水果沙拉")
Close()
ElseIf RadioButton3.Checked = True Then
MsgBox("您點的是洋芋沙拉")
Close()
End If
End Sub
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
RadioButton1.Text = "陽光沙拉"
RadioButton2.Text = "水果沙拉"
RadioButton3.Text = "洋芋沙拉"
End Sub
End Class
套餐 同一套餐第二人點,第二份可打9折(點的份數為偶數第二份才能打折)
回覆刪除If TextBox1.Text Mod 2 = 0 Or TextBox2.Text Mod 2 = 0 Or TextBox3.Text Mod 2 = 0 Or TextBox4.Text Mod 2 = 0 Or TextBox5.Text Mod 2 = 0 Then
meal = CInt(TextBox1.Text) * 298 * 0.9 + CInt(TextBox2.Text) * 229 * 0.9 + CInt(TextBox3.Text) * 239 * 0.9 + CInt(TextBox4.Text) * 319 * 0.9 + CInt(TextBox5.Text) * 359 * 0.9
Else
meal = CInt(TextBox1.Text) * 298 + CInt(TextBox2.Text) * 229 + CInt(TextBox3.Text) * 239 + CInt(TextBox4.Text) * 319 + CInt(TextBox5.Text) * 359
End If
不就等於你買2份 2份都折價 你買3份 3份都不打折了?
作者已經移除這則留言。
回覆刪除我覺得甜點和套餐處的程式應該這樣打
回覆刪除meal = CInt(TextBox1.Text \ 2) * 298 * 0.9 + CInt(TextBox2.Text \ 2) * 229 * 0.9 + CInt(TextBox3.Text \ 2) * 239 * 0.9 + CInt(TextBox4.Text \ 2) * 319 * 0.9 + CInt(TextBox5.Text \ 2) * 359 * 0.9 + (CInt(TextBox1.Text) - CInt(TextBox1.Text \ 2)) * 298 + (CInt(TextBox2.Text) - CInt(TextBox2.Text \ 2)) * 229 + (CInt(TextBox3.Text) - CInt(TextBox3.Text \ 2)) * 239 + (CInt(TextBox4.Text) - CInt(TextBox4.Text \ 2)) * 319 + (CInt(TextBox5.Text) - CInt(TextBox5.Text \ 2)) * 359
Dim a As Int16 = Val(TextBox2) + Val(TextBox4) + Val(TextBox5)
Dim b As Int16 = a - Val(TextBox8)
Dim c As Int16 = b - Val(TextBox7)
If a = 0 Then
sweet = Val(TextBox6.Text) * 45 + Val(TextBox7.Text) * 42 + Val(TextBox8.Text) * 50
ElseIf a <= Val(TextBox8) Then
sweet = a * 25 + (Val(TextBox8) - a) * 50 + Val(TextBox6) * 45 + Val(TextBox7) * 42
ElseIf a > Val(TextBox8) And b <= Val(TextBox6) Then
sweet = Val(TextBox8) * 25 + b * 20 + (Val(TextBox6) - b) * 45 + Val(TextBox7) * 42
ElseIf a > Val(TextBox8) And b > Val(TextBox6) And c < Val(TextBox7) Then
sweet = Val(TextBox8) * 25 + Val(TextBox6) * 20 + c * 15 + (Val(TextBox7) - c) * 42
Else
sweet = Val(TextBox8) * 25 + Val(TextBox6) * 20 + Val(TextBox7) * 15
End If