I am writing I program in Visual Basic I am suppose to calculate the average of three test. After I get the average I am suppose to give a letter grade on the application.
'calulates the grade from three test for the students in Professor Juarez class
'declare variables
Dim Test1 As Integer
Dim Test2 As Integer
Dim Test3 As Integer
Dim Avg As Integer
Dim Grade As Char
'convert input to a letter
'calculate the grade from the test scores
Avg = (Test1 + Test2 + Test3) / 3
If Avg >= 90 Then
Grade = "A"
Else
If Avg > 80 And Avg <= 89 Then
Grade = "B"
Else
If Avg > 70 And Avg <= 79 Then
Grade = "C"
Else
If Avg > 60 And Avg <= 69
Grade = "D"
Else
If Avg < 60 Then
Grade = "F"
End If
End If
End If
End If
End If
'display the letter grade for the average
GradeLab.Text = Convert.ToString(Grade)
End Sub
2007-03-15
15:38:22
·
4 answers
·
asked by
lil' Mama
1
in
Computers & Internet
➔ Programming & Design