I am creating a program using microsft visual c# 2008 express edition I have 4 l
ID: 3634785 • Letter: I
Question
I am creating a program using microsft visual c# 2008 express editionI have 4 lables 4 text boxes. The lables are asking for Player's Name,Players score, calculated average score and Below average score all 4 lables have corresponding text boxes. Once i enter the payers name, then score.
I would like it to palce the palyers with a score less than 50 into a listbox that says BelowAvgList. And all scores that are above 50 will be placed in a seperate list box that says Avg list ( the list box will have palyers name and score) . Once that is done i have two buttons, button (a) will calculate average scores, button (b) will calculate below average scores. The result of the calculated averages will be placed in 2 of the text boxes (averagetb & belowaveragetb)
Can some please put me on the right track. i have an idea however a litte guidance would be helpful
Explanation / Answer
Private Sub MoveDown()
Dim PlayerScore As String, PlayerName As String, x As Integer
PlayerScore = Int(txtaddscore.Text)
PlayerName = txtaddname.Text
If PlayerScore > intscore(9) Then 'If score is higher than lowest (Number 9) score
MsgBox "Congratulations you got a high score", vbInformation, "Top Ten"
For x = 0 To 9
If Int(PlayerScore) > intscore(x) Then
intnewpos = x 'Find highcores position
Exit For
End If
Next x
For x = 9 To intnewpos + 1 Step -1
strnames(x) = strnames(x - 1) 'move names down
intscore(x) = intscore(x - 1) 'move scores down
Next x
strnames(intnewpos) = PlayerName 'Give current name its position
intscore(intnewpos) = PlayerScore 'Give current score its position
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.