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-1S.CLS < prev    next >
Encoding:
Visual Basic class definition  |  1998-09-21  |  1.3 KB  |  62 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.  
  24. Property Let Name(ByVal vName As String)
  25.   m_name = vName
  26. End Property
  27.  
  28. Property Get SocSecNum() As String
  29.   SocSecNum = m_ssn
  30. End Property
  31.  
  32. Property Let SocSecNum(ByVal vNum As String)
  33.   m_ssn = vNum
  34. End Property
  35.  
  36. Property Let midGrade(ByVal vGrade As Single)
  37.   m_midterm = vGrade
  38. End Property
  39.  
  40. Property Let finGrade(ByVal vGrade As Single)
  41.   m_final = vGrade
  42. End Property
  43.  
  44. Public Function SemGrade() As String
  45.   Dim grade As Single
  46.   grade = (m_midterm + m_final) / 2
  47.   grade = Round(grade)   'Round the grade
  48.   Select Case grade
  49.     Case Is >= 90
  50.       SemGrade = "A"
  51.     Case Is >= 80
  52.       SemGrade = "B"
  53.     Case Is >= 70
  54.       SemGrade = "C"
  55.     Case Is >= 60
  56.       SemGrade = "D"
  57.     Case Else
  58.       SemGrade = "F"
  59.   End Select
  60. End Function
  61.  
  62.