-
display the Avg,
this application calculate and display the average score of 6 judges
so one listbox for the names of the persons and other for the score from 0 to 10
after a person score has been reorded reove from the list , this prevent the user from entering a judge's score more than once.
this is my NameListBox: ScoreListBox: 0 to 10
Robert
Linda
Louis
Rosa
David
Jane
So if i select Linda and she give a score of 5; then Rosa 9, robert 9,david 8,Loius 8,and Jane 7
on the Lbl Avg shuold appera the avg = 7.67
anyway that is the idea here is my code:
Private Sub frmPowder_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
' Add names to the Nameslistbox
NamesListBox.Items.Add("Robert")
NamesListBox.Items.Add("Linda")
NamesListBox.Items.Add("Louis")
NamesListBox.Items.Add("Rosa")
NamesListBox.Items.Add("David")
NamesListBox.Items.Add("Jane")
'Add scores to the scorelistbox
For score As Integer = 0 To 10
ScoreListBox.Items.Add(score.ToString)
Next
NamesListBox.SelectedItem = "David"
ScoreListBox.SelectedItem = "0"
End Sub
Private Sub LblCalc_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LblCalc.Click
Dim score As Integer
Dim numberOfScores As Integer 'Counter
Dim totalScores As Integer 'accumulator
Dim avg As Decimal
Dim names As String
names = Convert.ToString(Me.NamesListBox.SelectedItem)
If Name = "Robert" Then
score = Convert.ToInt32(Me.ScoreListBox.SelectedItem) + 1
ElseIf Name = "Linda" Then
score = Convert.ToInt32(Me.ScoreListBox.SelectedItem) + 1
End If
avg = score / 2
Me.LblAvg.Text = avg.ToString("n2")
-
Re: display the Avg,
I'm not entirely sure what the question is.
Can you restate the question?