Create a multi-dimensional array


Assignment:

I have a multi-dimensional array that needs to have the following questions answered each by a separate button and sub or function procedure.

The array is

Dim Kidsinsports(10,3) " schools + sports" e.g. School 1 has 10 kids in football, 10 in basketball and 10 in volleyball. Sports are organized by (Football, Basketball, Volleyball)

Dim costofsports(3,10) = equals to home much each individual school spent for Basketball, footbal, volleyball

Dim kidsinsports(,) As Integer = {{10, 10, 10}, {20, 10, 15}, {10, 5, 10}, {20, 20, 20}, {11, 10, 12}, {22, 10, 10}, {5, 0, 5}, {10, 12, 23}, {15, 3, 9}, {12, 17, 24}}

Dim costofsports(,) As Double = {{100, 200, 150, 120, 231, 102, 87, 145, 156, 130}, {100, 56, 78, 99, 105, 180, 230, 165, 134, 75}, {110, 120, 130, 140, 77, 120, 150, 150, 190, 200}}

1. Which school spent the most money on football

2. Which sport the last school spent the most money on

3. Which school had the most kids playing basketball

4. Which sport the third school had the most students participating

5. Total amount spent by call schools on volleyball

6. Total number of students who played any sport

7. Which school has the most students participating in sports

8. Which was the most popular sport in terms of money spent

9. Which was the most popular sport in terms of student participation

10. Total number of students playing basketball.

Dim kidsinsports(,) As Integer = {{10, 10, 10}, {20, 10, 15}, {10, 5, 10}, {20, 20, 20}, {11, 10, 12}, {22, 10, 10}, {5, 0, 5}, {10, 12, 23}, {15, 3, 9}, {12, 17, 24}}

Dim costofsports(,) As Double = {{100, 200, 150, 120, 231, 102, 87, 145, 156, 130}, {100, 56, 78, 99, 105, 180, 230, 165, 134, 75}, {110, 120, 130, 140, 77, 120, 150, 150, 190, 200}}

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim row, column As Integer
Print_Array()
End Sub
Sub print_array()

lstbox.items.add("The array printed row-wise is:")
Dim row, column, index As Integer
Dim cost As String

For index = 0 To 9
cost = cost & costofsports(index, 1)
Next
lstbox.Items.Add(costofsports)
lstbox.Items.Add("")

For index = 0 To 9
lstbox.Items.Add(costofsports(0, row))
Next

End Sub

Solution Preview :

Prepared by a verified Expert
Visual Basic Programming: Create a multi-dimensional array
Reference No:- TGS01938698

Now Priced at $25 (50% Discount)

Recommended (96%)

Rated (4.8/5)