Laporan Tugas Mata Kuliah PBO

DISUSUN
OLEH
HELMITA PUTRI (1123081)
D3 TI 2C

POLITEKNIK POS INDONESIA
DIPLOMA III
2013
Form1
Public Class Form1
Dim objMenumakanan As New ClsMenumakanan("D: PR Menu.txt")
Public Sub New()
InitializeComponent()...
Public Class ClsMenumakanan
Private m_Makanan As String
Private m_Harga As Single
Private m_Jumlah As Single
Private m_out...
End Sub
Function isValid() As Boolean
If m_Makanan <> "" And m_Makanan <> "Masukkan menu makanan" And m_Harga > 5000
Then
...
Hasil
Upcoming SlideShare
Loading in...5
×

Laporan tugas mata kuliah pbo yg ke 3

392
-1

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
392
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Laporan tugas mata kuliah pbo yg ke 3

  1. 1. Laporan Tugas Mata Kuliah PBO DISUSUN OLEH HELMITA PUTRI (1123081) D3 TI 2C POLITEKNIK POS INDONESIA DIPLOMA III 2013
  2. 2. Form1 Public Class Form1 Dim objMenumakanan As New ClsMenumakanan("D: PR Menu.txt") Public Sub New() InitializeComponent() txtmakanan.Text = objMenumakanan.Makanan txtharga.Text = objMenumakanan.Harga txtjumlah.Text = objMenumakanan.Jumlah End Sub Private Sub btntambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btntambah.Click objMenumakanan.Makanan = txtmakanan.Text() objMenumakanan.Harga = txtharga.Text() objMenumakanan.Jumlah = txtjumlah.Text() If objMenumakanan.isValid Then objMenumakanan.Cetak() bersihIsian() MessageBox.Show("Data sudah ditambah", "PR Menu") End If Dim tampil As Integer = FreeFile() FileOpen(tampil, "D: PR Menu.txt", OpenMode.Input) RichTextBox1.Text = InputString(tampil, LOF(tampil)) FileClose(tampil) End Sub Private Sub bersihIsian() With objMenumakanan .Bersih() txtmakanan.Text = .Makanan txtharga.Text = .Harga txtjumlah.Text = .Jumlah End With End Sub Private Sub TextBox2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtharga.KeyPress If Not ((e.KeyChar >= "0") And (e.KeyChar <= "9") Or e.KeyChar = vbBack) Then e.Handled = True End If End Sub End Class ClsMenumakanan.vb
  3. 3. Public Class ClsMenumakanan Private m_Makanan As String Private m_Harga As Single Private m_Jumlah As Single Private m_outputfile As String Private outputFile As System.IO.StreamWriter Public Sub New(ByVal value As String) m_Makanan = "Masukkan menu makanan" m_Harga = 0 m_Jumlah = 0 m_outputfile = value End Sub Public Property Makanan() As String Get Return m_Makanan End Get Set(ByVal value As String) If value <> "" And value <> "Masukkan menu makanan" Then m_Makanan = value Else MessageBox.Show("Masukkan Makanan yang benar", "Makanan") End If End Set End Property Public Property Harga() As Single Get Return m_Harga End Get Set(ByVal value As Single) If value > 5000 Then m_Harga = value Else MessageBox.Show("Masukkan di atas 5000", "Harga") End If End Set End Property Public Property Jumlah() As Integer Get Return m_Jumlah End Get Set(ByVal value As Integer) If value > 0 Then m_Jumlah = value Else MessageBox.Show("Masukkan di atas 0", "Jumlah") End If End Set End Property Public Sub Bersih() m_Makanan = "" m_Harga = 0 m_Jumlah = 0
  4. 4. End Sub Function isValid() As Boolean If m_Makanan <> "" And m_Makanan <> "Masukkan menu makanan" And m_Harga > 5000 Then Return True Else Return False End If End Function Function SubTotal() As Single Return Harga * m_Jumlah End Function Function PPN() As Single Return SubTotal() / 10% End Function Function Total() As Single Return SubTotal() + PPN() End Function Public Sub Cetak() outputFile = System.IO.File.AppendText(m_outputfile) outputFile.WriteLine("Makanan : " & m_Makanan) outputFile.WriteLine("Harga : " & m_Harga) outputFile.WriteLine("Jumlah : " & m_Jumlah) outputFile.WriteLine("subtotal : " & subtotal) outputFile.WriteLine("PPN : " & PPN()) outputFile.WriteLine("Total : " & Total()) outputFile.WriteLine("_____________________________________________") outputFile.Close() End Sub End Class Form1.vb (design)
  5. 5. Hasil

×