Jumat, 23 Maret 2012
Program Belanja pada Visual Basic
Listing program :
Dim disc As Double
Dim bel1, bel2, bel3, bel4, bel5, t_bayar, t_bel As Currency
Private Sub Command1_Click()
bel1 = Val(belanja1.Text)
bel2 = Val(belanja2.Text)
bel3 = Val(belanja3.Text)
bel4 = Val(belanja4.Text)
bel5 = Val(belanja5.Text)
t_bel = bel1 + bel2 + bel3 + bel4 + bel5
total_bel = t_bel
If (jam >= 8) And (jam <= 15) Then
If (t_bel >= 100000) And (t_bel <= 200000) Then
disc = 0.05 * t_bel
dis = 5
rupiah = disc
t_bayar = total_bel - disc
bayar = t_bayar
ElseIf (t_bel > 200000) And (t_bel <= 300000) Then
disc = 0.1 * t_bel
dis = 10
rupiah = disc
t_bayar = total_bel - disc
bayar = t_bayar
ElseIf t_bel > 300000 Then
disc = 0.15 * t_bel
dis = 15
rupiah = disc
t_bayar = total_bel - disc
bayar = t_bayar
Else
disc = 0 * t_bel
dis = 0
rupiah = disc
t_bayar = total_bel - disc
bayar = t_bayar
End If
Else
disc = 0 * t_bel
dis = 0
rupiah = disc
t_bayar = total_bel - disc
bayar = t_bayar
End If
End Sub
Langganan:
Posting Komentar (Atom)
0 komentar:
Posting Komentar