소스코드
Private Sub Command1_Click()
Dim sum As Integer
Dim avg As Double
Dim count As Integer
Dim grade As String
If Check1.Value = 1 Then
sum = sum + CInt(Text3.Text)
count = count + 1
End If
If Check2.Value = 1 Then
sum = sum + CInt(Text4.Text)
count = count + 1
End If
If Check3.Value = 1 Then
sum = sum + CInt(Text5.Text)
count = count + 1
End If
If Check4.Value = 1 Then
sum = sum + CInt(Text6.Text)
count = count + 1
End If
If Check5.Value = 1 Then
sum = sum + CInt(Text7.Text)
count = count + 1
End If
avg = sum / count
Select Case avg \ 10
Case 10, 9
grade = "A"
Case 8
grade = "B"
Case 7
grade = "C"
Case 6
grade = "D"
Case 5, 4, 3, 2, 1
grade = "F"
End Select
Text8.Text = sum
Text9.Text = avg
Text10.Text = grade
End Sub