-
Apr 30th, 2012, 01:07 PM
#1
Thread Starter
New Member
Test analysis program
cant figure out how to get average score low score and high score
All I have so far is how to bring up error messages
Private Sub enterButton_Click(sender As System.Object, e As System.EventArgs) Handles enterButton.Click
Dim scoreinteger As Integer
Try
scoreinteger = Integer.Parse(scoreText.Text)
Catch ex As Exception
MessageBox.Show("Please enter a numeric value", "Data Entry Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
Try
scoreinteger = Integer.Parse(scoreText.Text)
If scoreinteger > 100D Or scoreinteger < 0D Then
MessageBox.Show("The test score must be between 0 and 100", "Data Entry Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
Catch ex As Exception
Its a running count of test scores not a certain number, any ideas?
-
Apr 30th, 2012, 02:20 PM
#2
Junior Member
Re: Test analysis program
Keep four static variables, one for max one for min, one for number of times the proc has been called, and one for current average. Each time the proc is called, after you get past the error conditions, multiply the current average by the number of times the proc has been called, add the current value to the result, increment your number of times variable, and divide the former by the latter. Then, if the number is less than the min or more than the max store it to the appropriate variable.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|