HEADER

LOVE says if anything happens to you i am always there.... BUT friendship says, how can anything happen to you when i am there........

Minggu, 25 Desember 2011

SOAL VISUAL BASIC (pehitungan tiket bus)

SOAL
Diketahui perhitungan biaya bus dari pekanbaru ke bali
Data yang diinput:
-nama penumpang
-tanggal
-jenis penumpang             -(ekonomiA(dewasa))
                                                -(ekonomiB(anak-anak))
                                                -(bisnisA(dewasa))
                                                -(bisnisB(anak-anak))
                                                -(eksekutifA(dewasa))
                                                -(eksekutifB(anak-anak))
Harga tiket tergantung jenis penumpang
If ekonomiA maka Rp.500.000
If ekonomiB maka Rp.450.000
If bisnisA maka Rp.700.000
If bisnisB maka Rp.650.000
If eksekutifA maka Rp.1.000.000
If eksekutifB maka Rp.950.000


Penambahan fasilitas penginapan
Data yang diinput:
-jenis penginapan(ekonomi,standar,VIP,noninap(jika tidak menginap))
-lama penginapan
-harga penginapan tergantung jenis penginapan
If ekonomi maka Rp.75.000
If standaar maka Rp.100.000
If VIP maka Rp.175.000
If noninap Rp.0

Jumlah bayar=harga penginapan *jumlah inap + harga bus

Tipe penumpang (lokal, interlokal)
Discount tergantung tipe penumpang
If lokal maka discount 10%
If interlokal discount 5%
Discount= jumlah bayar * tipe penumpang
Jumlah bayar akhir = jumlah bayar – discount



JAWABAN



Private Sub Combo1_Click()
If Combo1 = "ekonomiA" Then
    Text2 = 500000
Else
If Combo1 = "ekonomiB" Then
    Text2 = 450000
Else
If Combo1 = "bisnisA" Then
    Text2 = 700000
Else
If Combo1 = "bisnisB" Then
    Text2 = 650000
Else
If Combo1 = "eksekutifA" Then
    Text2 = 1000000
Else
    Text2 = 950000
End If
End If
End If
End If
End If


End Sub

Private Sub combo2_Click()
If Combo2 = "ekonomi" Then
    Text3 = 75000
Else
If Combo2 = "standar" Then
    Text3 = 100000
Else
If Combo2 = "VIP" Then
    Text3 = 175000
Else
    Text3 = 0
    Text4 = 0
    Text5 = Val(Text2)
End If
End If
End If
End Sub

Private Sub Combo3_Click()
If Combo3 = "lokal" Then
    Text6 = Val(Text5) * 0.1
Else
    Text6 = Val(Text5) * 0.05
End If

Text7 = Val(Text5) - Val(Text6)

End Sub

Private Sub Form_Load()
Text1 = Clear
Text2 = Clear
Text3 = Clear
Text4 = Clear
Text5 = Clear
Text6 = Clear
Text7 = Clear

End Sub

Private Sub Text4_Change()
Text5 = Val(Text3) * Val(Text4) + Val(Text2)

End Sub

Private Sub Timer1_Timer()
Label15.Caption = Format(Now(), "hh:mm:ss")
End Sub

Tidak ada komentar:

Posting Komentar