Advertisement
Guest User

Untitled

a guest
May 29th, 2016
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. Public Class pros_stack
  2. Dim stk As New Stack(Of barang)
  3.  
  4. Private Sub beli(ByVal brg As barang)
  5. stk.Push(brg)
  6. stock += brg.jml
  7. End Sub
  8.  
  9. Private Function jual() As barang
  10. Dim hps As barang = stk.Pop
  11. stock -= hps.jml
  12. Return hps
  13. End Function
  14.  
  15. Public Sub proses()
  16. Dim putar As Boolean = True
  17. Dim pilih As Integer
  18. Dim new_brg As barang
  19. '
  20. Console.Clear()
  21. history.Clear()
  22. '
  23. Try
  24. Console.WriteLine(" Proses STACK")
  25. Console.WriteLine(" ------------")
  26. While putar
  27. Console.WriteLine(" Menu")
  28. Console.WriteLine(" 1. Beli")
  29. Console.WriteLine(" 2. Jual")
  30. Console.WriteLine(" 3. Selesai")
  31. Console.WriteLine()
  32. Console.Write("Pilih : ")
  33. pilih = Console.ReadLine
  34. If pilih = 1 Then ' BELI
  35. Console.WriteLine(" Proses Beli")
  36. Console.WriteLine(" ----------")
  37. Console.Write("Jumlah Barang : ")
  38. new_brg.jml = Console.ReadLine
  39. Console.Write("Harga Satuan : ")
  40. new_brg.hrg = Console.ReadLine
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement