|
Subclass
|
Public Class StudentBookSale
Inherits BookSale
Const mdecDISCOUNT_RATE As Decimal = 0.15D
Shared mdecDiscountTotal As Decimal
Shared ReadOnly Property DiscountTotal() As Decimal
Get
DiscountTotal = mdecDiscountTotal
End Get
End Property
Sub New()
'Constructor with empty argument list
MyBase.New() 'Call the base class constructor
End Sub
Sub New(ByVal Title As String, ByVal Quantity As Integer, _
ByVal Price As Decimal)
'Assign property values
MyBase.New() 'Call the base class constructor
Me.Title = Title
Me.Quantity = Quantity
Me.Price = Price
End Sub
Overrides Function ExtendedPrice() As Decimal
'Calculate the extended price and add to the totals
Dim decExtendedPrice As Decimal
Dim decDiscount As Decimal
decDiscount = mintQuantity * mdecPrice * mdecDISCOUNT_RATE
decExtendedPrice = mintQuantity * mdecPrice - decDiscount
mdecSalesTotal += decExtendedPrice
mintSalesCount += 1
mdecDiscountTotal += decDiscount
Return decExtendedPrice
End Function
End Class
|