Having a problem with getting this code right. I cant get the names to show up. Don't know how to do listbox, loop, or input box.
This was the problem: create an application that alows a teacher to enter 3 test scores each for three students. The application should calculate each student's average test score an assign a letter grade based on the following grade scale.
[/b]Average Test Score [b]Letter Grade
90 or better A
80 through 89 B
70 through 79 C
60 through 69 D
Below 60 F
The application should prompt the user for each student's name and three test scores. This is an example of how the application's form should appear after all data is entered. Example:
Jennie James: Average: 90.66666 Grade: A
Sammy Smith: Average: 73 Grade: C
Julie Williams: Average: 84.66666 Grade: B
vb
Private Sub btnEnter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnter.Click
'Declare varialbes
Dim Score1 As String
Dim Score2 As Double
Dim Score3 As Double
Dim Data As String
Dim Grade As String
'Get input
Score1 = InputBox("Enter Student Name, Student Name")
InputBox("Enter Student Grade, Student Grade")
InputBox("Enter Student Grade Letter, Grade Letter")
lblData.Text = Score1
'Calculate Average
Data = (Score1 Or Score2 Or Score3)
'Display Average
lblData.Text = FormatNumber(Data, 2)
'If score is high, compliment the student
If Data > 95 Then
MessageBox.Show("Congradulations! Great Job!", "Message")
Else
MessageBox.Show("Keep Trying", "Message")
End If
If Data >= 90 Then
Grade = "A"
ElseIf Data >= 80 Then
Grade = "B"
ElseIf Data >= 70 Then
Grade = "C"
ElseIf Data >= 60 Then
Grade = "D"
Else
Grade = "F"
End If
End Sub
This post has been edited by PsychoCoder: 22 Apr, 2008 - 05:52 PM