VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "Stock"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit
Private stockName As String     'nazwa akcji
Private investment As Single    'wysokość inwestycji
Private invDate As Date         'data dokonania inwestycji
Private rate As Single          'stopa wzrostu

Public Function getName() As String
  getName = stockName           'zwróć nazwę
End Function

Public Function getTaxable(toDate As Date) As Single
 'oblicz zysk do opodatkowania
 getTaxable = getValue(toDate) - investment
End Function

Public Function getValue(toDate As Date) As Single
  Dim diff, value As Single
  'Oblicz aktualną wartość inwestycji
  diff = DateDiff("d", invDate, toDate)
  value = (diff / 365) * rate * investment + investment
  getValue = value
End Function
Public Sub init(nm As String)
  stockName = nm                  'initialize the name
  rate = Rnd / 10                 'and a rate
End Sub
Public Sub invest(amt As Single)
  invDate = CVDate(Date$)         'ustaw datę
  investment = amt                'i wartość
End Sub
Public Function isBond() As Boolean
 isBond = False                   'nie jest obligacją
End Function
