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
Implements Equity
Private stockName As String       'nazwa
Private investment As Single      'zainwestowana kwota
Private invDate As Date           'data inwestycji
Private rate As Single            'stopa wzrostu

Private Function Equity_getName() As String
  Equity_getName = stockName      'zwróć nazwę
End Function

Private Function Equity_getTaxable(toDate As Date) As Single
  'oblicz zysk do opodatkowania
  Equity_getTaxable = Equity_getValue(toDate) - investment
End Function

Private Function Equity_getValue(toDate As Date) As Single
  Dim diff, value As Single
  'oblicz całkowitą wartość inwestycji na podany dzień
  diff = DateDiff("d", invDate, toDate)
  value = (diff / 365) * rate * investment + investment
  Equity_getValue = value
End Function

Private Sub Equity_init(nm As String)
  stockName = nm                  'zainicjalizuj nazwę
  rate = Rnd / 10                 'i stopę zysku
End Sub

Private Sub Equity_invest(amt As Single)
  invDate = CVDate(Date$)         'ustaw datę
  investment = amt                'i wartość inwestycji
End Sub

Private Function Equity_isBond() As Boolean
  Equity_isBond = False           'nie jest obligacją
End Function
