我已经从这里的问题中研究和阅读了所有内容,但是我所尝试的并没有解决问题。该函数用于向应用程序输出字母等级。以下是类和函数的代码,以便更清晰。
Public Class Coursegrade
'names private veriables
Private _Score1 As Integer
Private _Score2 As Integer
Private _Score3 As Integer
Private Letter_grade As String
'gets and returns each veriable
'for application use
Public Property Grade As String
Get
Return Letter_grade
End Get
Set(value As String)
If value > String.Empty Then
Letter_grade = value
Else
Letter_grade = String.Empty
End If
End Set
End Property
Public Property TestScore1 As Integer
Get
Return _Score1
End Get
Set(value As Integer)
If value > 0 Then
_Score1 = value
Else
_Score1 = 0
End If
End Set
End Property
Property TestScore2 As Integer
Get
Return _Score2
End Get
Set(value As Integer)
If value > 0 Then
_Score2 = value
Else
_Score2 = 0
End If
End Set
End Property
Public Property TestScore3 As Integer
Get
Return _Score3
End Get
Set(value As Integer)
If value > 0 Then
_Score3 = value
Else
_Score3 = 0
End If
End Set
End Property
'starts veriables of at 0
Public Sub New()
_Score1 = 0
_Score2 = 0
_Score3 = 0
End Sub
'calculates the adverage
Public Function Gettotal() As Integer
Return _Score1 + _Score2 + _Score3
End Function
Public Function Give_letter_grade() As String
Dim intTotal As Integer
intTotal = Gettotal()
'start your secletion
If intTotal <= 270 AndAlso intTotal >= 300 Then
Letter_grade = "A"
ElseIf intTotal <= 240 AndAlso intTotal >= 269 Then
Letter_grade = "B"
ElseIf intTotal <= 210 AndAlso intTotal >= 239 Then
Letter_grade = "C"
ElseIf intTotal <= 180 AndAlso intTotal >= 290 Then
Letter_grade = "D"
ElseIf intTotal > 180 Then
Letter_grade = "F"
Else
Letter_grade = ""
End If
End Function
错误显示在给出字母等级
的结束函数上答案 0 :(得分:0)
idname a c name
1 b d elisa1
2 b d elisa2
3 b d elisa3