nav#menunav { border-bottom: 1px solid #e8e8e8; }

Contoh Coding Tentang Penggunaan Elseif Visual Basic




kasus 1
Private Sub Command1_Click()
If cmbkelas.Text = "Biasa" And cmbtujuan.Text = "medan" And txtpeserta.Text <= 51 Then
txtbayar.Text = 1500000
ElseIf cmbkelas.Text = "Biasa" And cmbtujuan.Text = "medan" And txtpeserta.Text >= 50 Then
txtbayar.Text = (txtpeserta.Text * 30000) - (txtpeserta - 50) * (0.3 * 30000)
ElseIf cmbkelas.Text = "Biasa" And cmbtujuan.Text = "palembang" And txtpeserta.Text <= 41 Then
txtbayar.Text = 1000000
ElseIf cmbkelas.Text = "Biasa" And cmbtujuan.Text = "palembang" And txtpeserta.Text >= 40 Then
txtbayar.Text = (txtpeserta.Text * 25000) - (txtpeserta - 40) * (0.3 * 25000)
ElseIf cmbkelas.Text = "Biasa" And cmbtujuan.Text = "lampung" And txtpeserta.Text <= 61 Then
txtbayar.Text = 2400000
ElseIf cmbkelas.Text = "Biasa" And cmbtujuan.Text = "lampung" And txtpeserta.Text >= 60 Then
txtbayar.Text = (txtpeserta.Text * 40000) - (txtpeserta - 60) * (0.3 * 40000)
End If

If cmbkelas.Text = "luar biasa" And cmbtujuan.Text = "medan" And txtpeserta.Text <= 31 Then
txtbayar.Text = 1200000
ElseIf cmbkelas.Text = "luar biasa" And cmbtujuan.Text = "medan" And txtpeserta.Text >= 30 Then
txtbayar.Text = (txtpeserta.Text * 40000) - (txtpeserta - 30) * (0.3 * 40000)
ElseIf cmbkelas.Text = "luar biasa" And cmbtujuan.Text = "palembang" And txtpeserta.Text <= 51 Then
txtbayar.Text = 1750000
ElseIf cmbkelas.Text = "luar biasa" And cmbtujuan.Text = "palembang" And txtpeserta.Text >= 50 Then
txtbayar.Text = (txtpeserta.Text * 35000) - (txtpeserta - 50) * (0.3 * 35000)
ElseIf cmbkelas.Text = "luar biasa" And cmbtujuan.Text = "lampung" And txtpeserta.Text <= 71 Then
txtbayar.Text = 4200000
ElseIf cmbkelas.Text = "luar biasa" And cmbtujuan.Text = "lampung" And txtpeserta.Text >= 70 Then
txtbayar.Text = (txtpeserta.Text * 60000) - (txtpeserta - 70) * (0.3 * 60000)
End If

End Sub




Related Posts

0 Post a Comment