High and Low Test Scores

Page 1 of 1

3 Replies - 1767 Views - Last Post: 01 December 2012 - 09:17 PM Rate Topic: -----

#1 x RadicalAura x  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 29
  • Joined: 01-December 12

High and Low Test Scores

Posted 01 December 2012 - 08:53 PM

I am programming an application in VB that allows the user to input test scores and then it automatically calculates the average, high score, low score, and a grade distribution (A, B, C, D, F) for the entire class. I have the average, high score, and the distribution working for the most part. However, I am struggling with the low score. The high score works perfectly fine but by using the same logic to get the low score, it usually will leave the low score text box either blank or as "0" once I convert it back from an integer to a string. Also, my grade distribution label is a bit wacky. My instructor requested that we create one label for all letter grades and use concatenation to tie multiple strings together. For the most part, it works, but the problem I'm having is it's delayed. For instance, the first time I enter a number, it doesn't assign the grade to any letter grade value, but when I input a second score, it tracks it perfectly fine. The same applies to entering another score that would fall within a different letter grade category (e.g. 88 is counted as a "B" but then if I enter 70, for instance, immediately afterwards, it still tracks it as a B and will only be corrected after I enter another score.) Sorry for typing so much, I hope this is somewhat coherent. Thanks in advance for any advice, I'm new to VB.
 Dim highInteger As Integer
Dim lowInteger As Integer
Dim enteredInteger As Integer
Dim countA As Integer
Dim countB As Integer
Dim countC As Integer
Dim countD As Integer
Dim countF As Integer

'High and Low Score Code

If enteredInteger > highInteger Then
highInteger = enteredInteger
highTextBox.Text = highInteger.ToString()
End If

If enteredInteger <= 100 Then
lowInteger = enteredInteger
lowTextBox.Text = lowInteger.ToString()

End If


'Grade Distribution Label Code


gradesLabel.Text = "A's" & " " & countA.ToString() & " " & " " & "B's" & " " & countB.ToString() & " " & " " & "C's" & " " & countC.ToString() & " " & " " & "D's" & " " & countD.ToString() & " " & " " & "F's" & countF.ToString()

If enterButton.Enabled = True Then
End If
If enteredInteger >= 90 Then
countA = countA + 1
Else
If enteredInteger >= 80 And enteredInteger < 90 Then
countB = countB + 1
Else
If enteredInteger >= 70 And enteredInteger < 80 Then
countC = countC + 1
Else
If enteredInteger >= 60 And enteredInteger < 70 Then
countD = countD + 1
Else
countF = countF + 1
End If
End If
End If
End If 



By the way, just noticed that my low score code is completely off. I know, I know. It's essentially stating that any number less than or equal to 100 is the low score, which is obviously not what I am looking for. I just put that there temporarily because I was tired of seeing "0" or nothing. My original low score code looked like this:
If enteredInteger < lowInteger Then
lowInteger = enteredInteger
lowTextBox.Text = lowInteger.ToString()



Is This A Good Question/Topic? 0
  • +

Replies To: High and Low Test Scores

#2 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10821
  • View blog
  • Posts: 40,340
  • Joined: 27-December 08

Re: High and Low Test Scores

Posted 01 December 2012 - 08:55 PM

Are you doing this in VB6 or VB.NET? I'll close the thread in the incorrect forum.
Was This Post Helpful? 0
  • +
  • -

#3 x RadicalAura x  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 29
  • Joined: 01-December 12

Re: High and Low Test Scores

Posted 01 December 2012 - 09:10 PM

View Postmacosxnerd101, on 01 December 2012 - 08:55 PM, said:

Are you doing this in VB6 or VB.NET? I'll close the thread in the incorrect forum.

It's in .NET Framework 4. Sorry, I wasn't sure where to post it. Feel free to delete this thread.
Was This Post Helpful? 0
  • +
  • -

#4 GunnerInc  Icon User is offline

  • "Hurry up and wait"
  • member icon




Reputation: 876
  • View blog
  • Posts: 2,312
  • Joined: 28-March 11

Re: High and Low Test Scores

Posted 01 December 2012 - 09:17 PM

Duplicate - closed...
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1