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

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


Dim grades(,) = {
        {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
Asked:
bob saget
1 Solution
 
Nitin SontakkeDeveloperCommented:
Is this an assignment?

If yes, posting assignment questions is against the EE policy, is what I read somewhere.
0
 
Shaun VermaakTechnical 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
 
Kyle AbrahamsSenior .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}}

Open in new window


more info:
https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/arrays/how-to-initialize-an-array-variable
0
 
bob sagetAuthor 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.

Join & Write a Comment

Featured Post

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now