Assume the following 2-dimensional array has been declared: int [] [] table3x5 = new int [3] [5];
Fantastic news! We've Found the answer you've been seeking!
Question:
Assume the following 2-dimensional array has been declared:
int [] [] table3x5 =newint [3] [5]; |
Indicate the contents produced by each of the following (1st ex has been done as an example):
1 | for (int j =0; j <3; j++) for (int k =0; k <5; k++) table3x5[j][k] = j - k; |
0 -1 -2 -3 -4 1 0 -1 -2 -3 2 1 0 -1 -2 |
2 | for (int j =0; j <3; j++) for (int k =0; k <5; k++) table3x5[j][k] = j; |
3 | for (int j =0; j <3; j++) for (int k =0; k <5; k++) table3x5[j][k] = k; |
4 | for (int j =0; j <3; j++) for (int k =0; k <5; k++) table3x5[j][k] = k % (j +1); |
Declare a 2-dimensional array for the tables described:
Ex | A table with song lengths for 3 artists and 4 songs for each artist. |
double [ ] [ ] songLengths= new double [3] [4]; |
5 | A table with real number entries that shows the prices for four different drugs charged by 5 different drug stores. |
6 | A table with String entries that shows the grades earned by 20 students in 6 classes. |
7 | A table with integer entries that shows the 12 quiz scores earned by 30 students in a class. |
Related Book For
Posted Date: