• Status: Solved
• Priority: Low
• Security: Public
• Views: 47

# declare a two dimensional array that can hold 4 grades for 10 students.

how do i declare a two dimensional array that can hold 4 grades for 10 students. Initialize the array with the following grades using {} notation.  Column 0 represents Exam 1, column 1 represents exam 2, column 2 represents exam 3, and column 3 represents exam 4. For each exam, print out the average of the exam grade for all students in a listbox. (i have to use a  nested for next loop for this. i am also given this code

{80, 63, 59, 50},
{96, 97, 98, 94},
{88, 70, 63, 89},
{63, 68, 86, 84},
{72, 84, 86, 63},
{84, 84, 80, 87},
{72, 79, 64, 92},
{89, 63, 99, 65},
{99, 98, 97, 98},
{99, 69, 62, 98}}
0
bob saget
1 Solution

DeveloperCommented:
Is this an assignment?

If yes, posting assignment questions is against the EE policy, is what I read somewhere.
0

Technical Specialist/DeveloperCommented:
If yes, posting assignment questions is against the EE policy, is what I read somewhere.
No, that changed last year, not that I am encouraging it

how do i declare a two dimensional array that can hold 4 grades for 10 students.
Okay, so you have this

For each exam, print out the average of the exam grade for all students in a listbox.
Add the variable definition add a line break after this to inspect the contents. Notice how the array values are stores (Student, Exam} IOW student 2 scores for exam 3 is in (2,3). This means you have to loop through students and then scores, summing to four variables. After loops divide these variables by the number of students (UBound first dimension)
0

Senior .Net DeveloperCommented:
``````Dim grades as Integer(,) = {
{80, 63, 59, 50},
{96, 97, 98, 94},
{88, 70, 63, 89},
{63, 68, 86, 84},
{72, 84, 86, 63},
{84, 84, 80, 87},
{72, 79, 64, 92},
{89, 63, 99, 65},
{99, 98, 97, 98},
{99, 69, 62, 98}}
``````

https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/arrays/how-to-initialize-an-array-variable
0

Author Commented:
thanks for the website
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.