Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Class Student
  2.  
  3.     Private p_ID As String
  4.     Private p_Name As String
  5.     Private p_Score1 As Integer
  6.     Private p_Score2 As Integer
  7.     Public Shared g_StudentCount As Integer = 0
  8.  
  9.     Public ReadOnly Property ID As String
  10.         Get
  11.             Return p_ID
  12.         End Get
  13.     End Property
  14.  
  15.     Public Property Name As String
  16.         Get
  17.             Return p_Name
  18.         End Get
  19.         Set(ByVal value As String)
  20.             p_Name = value
  21.         End Set
  22.     End Property
  23.  
  24.     Public Property Score1 As Integer
  25.         Get
  26.             Return p_Score1
  27.         End Get
  28.         Set(ByVal value As Integer)
  29.             p_Score1 = value
  30.         End Set
  31.     End Property
  32.  
  33.     Public Property Score2 As Integer
  34.         Get
  35.             Return p_Score2
  36.         End Get
  37.         Set(ByVal value As Integer)
  38.             p_Score2 = value
  39.         End Set
  40.     End Property
  41.  
  42.     Public Shared ReadOnly Property StudentCount As Integer
  43.         Get
  44.             Return g_StudentCount
  45.         End Get
  46.     End Property
  47.  
  48.  
  49.     Public Sub New(ByVal name As String, ByVal score1 As Integer, ByVal score2 As Integer)
  50.         g_StudentCount += 1
  51.         p_ID = g_StudentCount
  52.         p_Name = name
  53.         p_Score1 = score1
  54.         p_Score2 = score2
  55.     End Sub
  56.  
  57.     Public Function CalculateAverage() As Integer
  58.         Dim sum As Integer = p_Score1 + p_Score2
  59.         Return sum / 2
  60.     End Function
  61. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement