class1.vb
来自「学习vb过程中老师讲过的所有案例!还有课程设计」· VB 代码 · 共 96 行
VB
96 行
Public Class student
Private snumber As Integer
Private sname As String
Private sTel As String
Private smathscore As Integer
Private scomputerscore As Integer
Private ssum As Integer
Private save As Double
Public Sub New()
Me.snumber = 70345
Me.sname = "zhang"
Me.sTel = 1391456655
Me.smathscore = 80
Me.scomputerscore = 90
Me.ssum = 170
Me.save = 85
End Sub
Public Sub New(ByVal snb As Integer, ByVal sn As String, ByVal st As Integer, ByVal sm As Integer, ByVal sc As Integer, ByVal ss As Integer, ByVal sa As Double)
Me.snumber = snb
Me.sname = sn
Me.sTel = st
Me.smathscore = sm
Me.scomputerscore = sc
Me.ssum = ss
Me.save = sa
End Sub
Public Property name() As String
Get
Return sname
End Get
Set(ByVal Value As String)
sname = Value
End Set
End Property
Public Property phone() As Integer
Get
Return sTel
End Get
Set(ByVal Value As Integer)
sTel = Value
End Set
End Property
Public Property number() As Integer
Get
Return snumber
End Get
Set(ByVal Value As Integer)
snumber = Value
End Set
End Property
Public Property math() As String
Get
Return smathscore
End Get
Set(ByVal Value As String)
smathscore = Value
End Set
End Property
Public Property computerscore() As Integer
Get
Return scomputerscore
End Get
Set(ByVal Value As Integer)
scomputerscore = Value
End Set
End Property
Public Function ave() As Integer
Dim x, y As Integer
Dim a As Double
a = (x + y) / 2
Return a
End Function
Public Function ssun() As Integer
Dim x, y As Integer
ssum = x + y
return ssum
End Function
Public Function studentinfo() As String
Dim s As String
Dim c1 As String = vbCrLf
s = s & "姓 名:" & Me.name & c1
s = s & "电话号码:" & Me.phone & c1
s = s & "学 号: " & Me.number & c1
s = s & " 数学成绩:" & Me.math & c1
s = s & "计算机成绩:" & Me.scomputerscore & c1
Return s
End Function
End Class
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?