home *** CD-ROM | disk | FTP | other *** search
/ An Introduction to Progr…l Basic 6.0 (4th Edition) / An Introduction to Programming using Visual Basic 6.0.iso / PROGRAMS / CH13 / 13-2-2S.CLS < prev    next >
Encoding:
Visual Basic class definition  |  1998-09-20  |  1.3 KB  |  61 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4.   Persistable = 0  'NotPersistable
  5.   DataBindingBehavior = 0  'vbNone
  6.   DataSourceBehavior  = 0  'vbNone
  7.   MTSTransactionMode  = 0  'NotAnMTSObject
  8. END
  9. Attribute VB_Name = "CSTudent"
  10. Attribute VB_GlobalNameSpace = False
  11. Attribute VB_Creatable = True
  12. Attribute VB_PredeclaredId = False
  13. Attribute VB_Exposed = False
  14. 'Student Class
  15. Private m_name As String
  16. Private m_ssn As String
  17. Private m_midterm As Single
  18. Private m_final As Single
  19.  
  20. Property Get Name() As String
  21.   Name = m_name
  22. End Property
  23. Property Let Name(ByVal vName As String)
  24.   m_name = vName
  25. End Property
  26.  
  27. Property Get SocSecNum() As String
  28.   SocSecNum = m_ssn
  29. End Property
  30.  
  31. Property Let SocSecNum(ByVal vNum As String)
  32.   m_ssn = vNum
  33. End Property
  34.  
  35. Property Let midGrade(ByVal vGrade As Single)
  36.   m_midterm = vGrade
  37. End Property
  38.  
  39. Property Let finGrade(ByVal vGrade As Single)
  40.   m_final = vGrade
  41. End Property
  42.  
  43. Public Function SemGrade() As String
  44.   Dim grade As Single
  45.   grade = (m_midterm + m_final) / 2
  46.   grade = Round(grade)   'Round the grade
  47.   Select Case grade
  48.     Case Is >= 90
  49.       SemGrade = "A"
  50.     Case Is >= 80
  51.       SemGrade = "B"
  52.     Case Is >= 70
  53.       SemGrade = "C"
  54.     Case Is >= 60
  55.       SemGrade = "D"
  56.     Case Else
  57.       SemGrade = "F"
  58.   End Select
  59. End Function
  60.  
  61.