Tugas VB, Program Kasir & Hitung Banyak Kata


Program Kasir,,

Public Class Form2
Private Sub btnhitungulang_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnpilih.Click
Dim namabrg As String
Dim jmlbrg = (tbjmljnsbrg.Text)
Dim hargabrg, jml, jmltotal, total As Integer
Dim i As Integer
For i = 1 To jmlbrg
namabrg = InputBox(“Masukkan Nama Barang ke- ” & i & “1)buku..2)pensil..3)permen..”)
jml = InputBox(“Banyak barang ke-” & i)

If namabrg = “buku” Then
hargabrg = 4000
ElseIf namabrg = “pensil” Then
hargabrg = 2000
ElseIf namabrg = “permen” Then
hargabrg = 3000
End If
total = jml * hargabrg
jmltotal = jmltotal + total
ListBox1.Items.Add(namabrg)
ListBox2.Items.Add(jml)
ListBox3.Items.Add(hargabrg)
ListBox4.Items.Add(total)
Next
tbtotalbeli.Text = jmltotal
End Sub
Private Sub btnkeluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnkeluar.Click
Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim total As Integer
Dim uangpembeli, kembalian As Double

uangpembeli = tbuangbeli.Text
total = tbtotalbeli.Text
kembalian = uangpembeli – total

tbkembalian.Text = kembalian
If uangpembeli < total Then
kembalian = kembalian * (-1)
MessageBox.Show(“Maaf, uang anda tidak mencukupi. Kurang Rp.” & kembalian)
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
tbjmljnsbrg.Clear()
ListBox1.Items.Clear()
ListBox2.Items.Clear()
ListBox3.Items.Clear()
ListBox4.Items.Clear()
tbtotalbeli.Clear()
tbuangbeli.Clear()
tbkembalian.Clear()
End Sub
End Class

Bentuk Formnya seperti ini,,
Program Hitung Kata

Public Class frmhtgkata

Private Sub btnhasil_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhasil.Click
Dim i, jmlA As Integer
Dim a As String

‘Tampilkan Jumlah Kata
a = tbinput.Text
jmlA = 1
For i = 1 To Len(Trim(a))
If Asc(Mid(a, i, 1)) = 13 Or Asc(Mid(a, i, 1)) = 32 Then
jmlA = jmlA + 1
End If
Next i
tbjmlkata.Text = jmlA
End Sub

End Class

Bentuk Formnya seperti ini :

form1

Semoga bermanfaat,,,

Posted on 4 Juli 2011, in Tugas Mata Kuliah, Visual Basic. Bookmark the permalink. Tinggalkan komentar.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: