Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Problem with a Variable in an array

dhess62dhess62 Member Posts: 7
I have this program which figures a grade based on points, but you have to enter the exact numbers shown in the array to get the letter grade. Now I need to modify it so for instance if I put in a number between 350 and 399 it will produce a grade of "C", 400 to 449 will produce a grade of "B" etc. Any help would be greatly appreciated.

'This calculates the grades
Dim grades() As String = {"A", "B", "C", "D", "F"}
Dim points() As Integer = {"500", "449", "399", "349", "299"}
Dim searchFor As String
Dim subscript As Integer
searchFor = txtPointsEarned.Text

Do Until subscript = points.Length _
OrElse searchFor = points(subscript)
subscript = subscript + 1
Loop
If subscript < points.Length Then
Me.lblDisplayGrade.Text = grades(subscript).ToString
Sign In or Register to comment.