Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Student
- Private p_ID As String
- Private p_Name As String
- Private p_Score1 As Integer
- Private p_Score2 As Integer
- Public Shared g_StudentCount As Integer = 0
- Public ReadOnly Property ID As String
- Get
- Return p_ID
- End Get
- End Property
- Public Property Name As String
- Get
- Return p_Name
- End Get
- Set(ByVal value As String)
- p_Name = value
- End Set
- End Property
- Public Property Score1 As Integer
- Get
- Return p_Score1
- End Get
- Set(ByVal value As Integer)
- p_Score1 = value
- End Set
- End Property
- Public Property Score2 As Integer
- Get
- Return p_Score2
- End Get
- Set(ByVal value As Integer)
- p_Score2 = value
- End Set
- End Property
- Public Shared ReadOnly Property StudentCount As Integer
- Get
- Return g_StudentCount
- End Get
- End Property
- Public Sub New(ByVal name As String, ByVal score1 As Integer, ByVal score2 As Integer)
- g_StudentCount += 1
- p_ID = g_StudentCount
- p_Name = name
- p_Score1 = score1
- p_Score2 = score2
- End Sub
- Public Function CalculateAverage() As Integer
- Dim sum As Integer = p_Score1 + p_Score2
- Return sum / 2
- End Function
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement