Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

Public Class clsBook

Private Shared books As New ArrayList()


Private bookIdentifier As String
Private bookAuthor As String
Private bookTitle As String
Private bookPurchasePrice As Decimal
Private bookSalePrice As Decimal
Private bookInventory As Integer

Public Property BookID() As String


Get
Return bookIdentifier
End Get
Set(ByVal value As String)
bookIdentifier = value
End Set
End Property

Public Property Author() As String


Get
Return bookAuthor
End Get
Set(ByVal value As String)
bookAuthor = value
End Set
End Property

Public Property Title() As String


Get
Return bookTitle
End Get
Set(ByVal value As String)
bookTitle = value
End Set
End Property

Public Property PurchasePrice() As Decimal


Get
Return bookPurchasePrice
End Get
Set(ByVal value As Decimal)
bookPurchasePrice = value
End Set
End Property

Public Property SalePrice() As Decimal


Get
Return bookSalePrice
End Get
Set(ByVal value As Decimal)
bookSalePrice = value
End Set
End Property

Public Property Inventory() As Integer


Get
Return bookInventory
End Get
Set(ByVal value As Integer)
bookInventory = value
End Set
End Property

Public Shared Sub Initialize()


books.Add(New clsBook("1111111111", "C.S. Lewis", _
"The Lion, The Witch, and the Wardrobe", 350, 100, 1))
books.Add(New clsBook("2222222222", "J.R.R. Tolkien", _
"The Return of the King", 350, 100, 1))
books.Add(New clsBook("3333333333", "J.K. Rowling", _
"Harry Potter and the Deathly Hallows", 350, 100, 1))
End Sub
Public Shared Function GetAll() As ArrayList
Return books
End Function

Public Sub New(ByVal aBookID As String, ByVal anAuthor As String, _


ByVal aTitle As String, ByVal aPurchasePrice As Decimal, ByVal _
aSalePrice As Decimal, ByVal anInventory As Integer)
bookIdentifier = aBookID
bookAuthor = anAuthor
bookTitle = aTitle
bookPurchasePrice = aPurchasePrice
bookSalePrice = aSalePrice
bookInventory = anInventory
End Sub

Public Sub New()


End Sub

Public Sub Add()


books.Add(Me)
End Sub

Public Sub Update()


Dim index As Integer
Do Until books(index).BookId.Equals(Me.BookID)
index = index + 1
Loop
books(index) = Me
End Sub

Public Sub Delete()


books.Remove(Me)
End Sub
End Class

You might also like