Please Use Visual Basics for this solution : In this exercise, you code an appli
ID: 3574860 • Letter: P
Question
Please Use Visual Basics for this solution: In this exercise, you code an application that displays the number of students earning a specific score. (1-5, 11) a. Open the Scores Solution (Scores Solution.sln) file contained in the VbReloaded2012Chap09Scores Solution folder. Declare a class-level, onedimensional Integer array named scores. Initialize the array using the following 20 numbers: 88, 72, 99, 20, 66, 95, 99, 100, 72, 88, 78, 45, 57, 89, 85, 78, 75, 88, 72, and 88. b. Open the code template for the displayButton_Click procedure. The procedure should prompt the user to enter a score from 0 through 100. It should then display (in a message box) the number of students who earned that score. Code the procedure. c. Save the solution and then start the application. Use the application to answer the following questions: How many students earned a score of 72? How many students earned a score of 88? How many students earned a score of 20? How many students earned a score of 99? Close the solution. Pleasae use Visual Basics for this Solution.
Explanation / Answer
Program to display the number of students earning a specific score
Option Explicit On
Option Strict On
Option Infer Off
Public Class frmMain
Private Sub btnExit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub
Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub btnDisplay_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
// following search the array, for values that match the value entered by the user
Dim intScore() As Integer = {88, 72, 99, 20, 66, 95, 99, 100, 72, 88, 78, 45, 57, 89, 85, 78, 75, 88, 72, 88}
Dim intSearchAmount As Integer
Dim intCounter As Integer
Integer.TryParse(txtScore.Text, intSearchAmount)
// search the array, update intCounter
For intSubscript As Integer = 0 To 100
If intScore(intSubscript) = intSearchAmount Then // how many have that mark entered then you need to increase the count like
intCounter += intCounter
End If
Next intSubscript
txtScore.Focus()
// display the result
MessageBox.Show("0", "Students With This Score", _
MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
Private Sub txtScore_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles txtScore.Enter
txtScore.SelectAll()
End Sub
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.