76 293
Assignments Done
Successfully Done
In May 2019

Answer to Question #30159 in Visual Basic for jack

Question #30159
write a VB program that reads 50 grades (each grade should be between 0 and 100), and then produces the frequency of each grade. The result should be stored in an array. You should not use any type of IF statements or SELECT CASE statement.
Example: Suppose the input grades are 1,4,3,4,1,4,2 … The output should be as follows:

grade frequency
0 0
1 2
2 1
3 1
4 3
100 0
Expert's answer
Module Module1
Private arrayofGrades(50) As Integer 'decalre variable arrayofGrades
Private arrayofGradescounts(50) As Integer 'decalre variable
Sub Main()
For i As Integer = 0 To 49
Console.Write("Enter grade: ") 'input grades
arrayofGrades(i) = Integer.Parse(Console.ReadLine()) 'read grade
'calculate the frequency of each grade
For i As Integer = 0 To 99
arrayofGradescounts(arrayofGrades(i)) += 1

'show result
For i As Integer = 0 To 99
Console.Write((i + 1).ToString() + " " +
End Sub

End Module

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions