Option Explicit
'Svojstva
Dim ime As String
Dim prezime As String
Dim datumRodjenja As Date
Dim indeks As String
Dim polozxeniIspiti As Collection
Dim ocene As Collection ' ocena(j) je ocena koju je student dobio prilikom polaganja ispita polozxeniIspiti(j)
'Metodi
Sub Init(sIme As String, sPrezime As String, dtDatumRodjenja As Date, sIndeks As String)
ime = sIme
prezime = sPrezime
datumRodjenja = dtDatumRodjenja
indeks = sIndeks
Set polozxeniIspiti = New Collection
Set ocene = New Collection
End Sub
Sub dodajPolozxeniIspit(predmet As String, ocena As Integer)
polozxeniIspiti.Add predmet
ocene.Add ocena
End Sub
Function prosekStudenta() As Double
If ocene.Count = 0 Then
prosekStudenta = 0
Else
Dim zbirOcena As Integer
zbirOcena = 0
Dim j As Integer
For j = 1 To ocene.Count
zbirOcena = zbirOcena + ocene(j)
Next
prosekStudenta = zbirOcena / ocene.Count
End If
End Function
Function JeDiplomirao(ukupnoIspita As Integer) As Boolean
If polozxeniIspiti.Count = ukupnoIspita Then
JeDiplomirao = True
Else
JeDiplomirao = False
End If
End Function
Sub CurriculumVitae()
Dim cv As String
cv = "Ime i prezime: " & ime & " " & prezime & vbCrLf
cv = cv & "Datum rodjenja: " & datumRodjenja & vbCrLf
cv = cv & "Indeks: " & indeks & vbCrLf
cv = cv & "Polozxeni ispiti:" & vbCrLf
Dim j As Integer
For j = 1 To polozxeniIspiti.Count
cv = cv & vbTab & polozxeniIspiti(j) & vbTab & ocene(j) & vbCrLf
Next
cv = cv & "Prosek: " & prosekStudenta()
MsgBox cv
End Sub