Latihan VB,Net
Public Class garudatravel
Private Sub garudatravel_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.cmbTujuan.Items.Clear()
Me.cmbTujuan.Items.Add("Hongkong")
Me.cmbTujuan.Items.Add("Singapore")
Me.cmbTujuan.Items.Add("Philipina")
Me.cmbTujuan.Items.Add("Thailand")
Me.cmbTujuan.Items.Add("Jepang")
Me.cmbTujuan.Items.Add("Korea")
End Sub
Private Sub Cekharga_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Cekharga.Click
If
cmbTujuan.Text = "Hongkong" Then
lblTarif.Text = 3750000
ElseIf
cmbTujuan.Text = "Singapore" Then
lblTarif.Text = 1750000
ElseIf
cmbTujuan.Text = "Philipina" Then
lblTarif.Text = 2200000
ElseIf
cmbTujuan.Text = "Thailand" Then
lblTarif.Text = 3850000
ElseIf
cmbTujuan.Text = "Jepang" Then
lblTarif.Text = 4000000
Else
lblTarif.Text = 4200000
End If
If
cmbTujuan.Text = "Hongkong" Then
lblExtra.Text = 425000
ElseIf
cmbTujuan.Text = "Singapore" Then
lblExtra.Text = 200000
ElseIf
cmbTujuan.Text = "Philipina" Then
lblExtra.Text = 400000
ElseIf
cmbTujuan.Text = "Thailand" Then
lblExtra.Text = 450000
ElseIf
cmbTujuan.Text = "Jepang" Then
lblExtra.Text = 500000
Else
lblExtra.Text = 600000
End If
If
txtLama.Text > 4 Then
lblExtra.Text = (txtLama.Text - 4)
* Val(lblExtra.Text)
ElseIf
txtLama.Text <= 4 Then
lblExtra.Text = 0
End If
Dim
disc As New Integer
lblDisc.Text = disc
If
txtLama.Text >= 6 Then
lblDisc.Text = (Val(lblTarif.Text)
+ Val(lblExtra.Text)) * 0.15
Else
lblDisc.Text = (Val(lblTarif.Text)
+ Val(lblExtra.Text)) * 0
End If
lblSub.Text = (Val(lblTarif.Text) +
Val(lblExtra.Text)) - Val(lblDisc.Text)
lblPjk.Text = Val(lblSub.Text) * 0.1
lblTot.Text = Val(lblSub.Text) +
Val(lblPjk.Text)
End Sub
Private Sub clear_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles clear.Click
Me.TextBox1.Clear()
Me.cmbTujuan.Text
= ""
Me.txtLama.Clear()
Me.lblTarif.Text
= ""
Me.lblExtra.Text
= ""
Me.lblDisc.Text
= ""
Me.lblSub.Text
= ""
Me.lblPjk.Text
= ""
Me.lblTot.Text
= ""
End Sub
End Class
