jeudi 15 décembre 2016

Visual Studio: Else If statement and calculation not matching up, always the same results

I'm writing a program for school, calculating the average test scores of 3 tests and then have a message box relaying the grade for the average.

However, once I type in the 3 test scores, the message box always kicks out an "F" even if the average is over 80.

Private Sub CalcRtn ()          
Do
If sngAvg > = 90 And 100 Then                    
MsgBox ("You got an A ! Well Done .")          
ElseIf sngAvg > = 80 And sngAvg < = 89 Then
MsgBox ("You got a B ")
ElseIf sngAvg > = 70 And sngAvg < = 79 Then
MsgBox (" Final Grade : C ")
ElseIf sngAvg > = 60 And sngAvg < = 69 Then
MsgBox (" Final Grade : D ")
ElseIf sngAvg < 60 Then
MsgBox ("You Failed the Class : F ")
End If

' ** Calculate Average Scores

sngAvg = ( sngTest 1 + sngTest 2 + sngTest 3 ) / 3

' ** PROMPT

strDone = InputBox ("Would you like another Average Test Score Calculation (Y or N ) ? " , " Contintuation ")

Loop Until strDone = "N" or strDone = "n"

What am I doing wrong?

Aucun commentaire:

Enregistrer un commentaire