3. Analyze line 45 of the program code (copied below) as well as the output to...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
3. Analyze line 45 of the program code (copied below) as well as the output to the console, then answer the following int [][][] intArr3D = {{{4,8,1}, {0,3,7}}, {{1,9,3},{2,8,6}}, {{4,3,8}, {9,0,2}}}; a) What parts make up the (two-dimensional) arrays and rows of intArr3D? (In the space label arrays 0, 1, and 2. Also label rows 0 and 1 for each of those arrays.) b) At what specific cells can the value 9 be found? 2 Line # 2. Java Code //This program is used to explore how to declare and use multi- dimensional arrays.. public class MultiDArrays { public static void main(String[] args) { 6. 7. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20 Multi-Dimensional Arrays JAVA-PROGRAMMING ACTIVITY //Declare a two-dimensional array of int values with 3 rows and 4 columns. int [][] intArr2D_A = new int [3][4]; //Initialize the array one value at a time. intArr2D A[0][0] = 3; intArr2D A[0][1] = 5; intArr2D A[0][2] = 1; intArr2D A[0][3] = 7; intArr2D A[1][0] = 2; intArr2D A[1][1] = 1; intArr2D A[1][2] = 9; intArr2D A[1][3] = 3; intArr2D A[2][0] = 8; intArr2D A[2][1] = 2; intArr2D A[2][2] = 6; intArr2D A[2][3] = 5; //Write out the contents of the array. System.out.println("A 3-row by 4-column 2-D Array of int Values (First Array)"); for (int i=0; i <3; i++) { for (int j=0; j <4; j++) { System.out.print(intArr2D_A[i][j]+" "); System.out.println(); //Declare and initialize a second two-dimensional array of int values with 2 rows and 6 columns. //This shows another approach to declaring and initializing, which can be done in only one line. int [][] intArr2D B = ((8,1,3,6,4,2), (7,9,2,0,5,1)); //Write out the contents of the second array. System.out.println(" A 2-row by 6-column 2-D Array of int 21. 22. 23. 24. 25. 26. 27. 28. } 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. } 40. 41. } 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. Values (Second Array)"); for (int i=0; i <2; i++) { for (int j=0; j <6; j++) { System.out.print(intArr20 B[i][j]+" "); System.out.println(); //Declare and initialize a three-dimensional array of int values with 3 (2-D) arrays of 2 rows and 3 columns. //This shows an approach to declaring and initializing a 3-D array, which can be done in only one line. int [][][] intArr3D = {{{4,8,1),(8,3,7}}, {{1,9,3), (2,8,6}}, ((4,3,8),(9,0,2)}}; //Write out the contents of the array. System.out.println(" A 3-array by 2-row by 3-column 3-D Array of int Values"); for (int i=0; i <3; i++) { System.out.println("Array "+i); for (int j=0; j <2; j++) { ulti-Dimensional Arrays JAVA-PROGRAMMING ACTIVITY 52. for (int k-8; k <3; k++) { System.out.print(intArr30[i][j][k]+" "); 53. 54. 55. System.out.println(); 56. 57. System.out.println(); 58. 59. 60. 3 3. Analyze line 45 of the program code (copied below) as well as the output to the console, then answer the following int [][][] intArr3D = {{{4,8,1}, {0,3,7}}, {{1,9,3},{2,8,6}}, {{4,3,8}, {9,0,2}}}; a) What parts make up the (two-dimensional) arrays and rows of intArr3D? (In the space label arrays 0, 1, and 2. Also label rows 0 and 1 for each of those arrays.) b) At what specific cells can the value 9 be found? 2 Line # 2. Java Code //This program is used to explore how to declare and use multi- dimensional arrays.. public class MultiDArrays { public static void main(String[] args) { 6. 7. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20 Multi-Dimensional Arrays JAVA-PROGRAMMING ACTIVITY //Declare a two-dimensional array of int values with 3 rows and 4 columns. int [][] intArr2D_A = new int [3][4]; //Initialize the array one value at a time. intArr2D A[0][0] = 3; intArr2D A[0][1] = 5; intArr2D A[0][2] = 1; intArr2D A[0][3] = 7; intArr2D A[1][0] = 2; intArr2D A[1][1] = 1; intArr2D A[1][2] = 9; intArr2D A[1][3] = 3; intArr2D A[2][0] = 8; intArr2D A[2][1] = 2; intArr2D A[2][2] = 6; intArr2D A[2][3] = 5; //Write out the contents of the array. System.out.println("A 3-row by 4-column 2-D Array of int Values (First Array)"); for (int i=0; i <3; i++) { for (int j=0; j <4; j++) { System.out.print(intArr2D_A[i][j]+" "); System.out.println(); //Declare and initialize a second two-dimensional array of int values with 2 rows and 6 columns. //This shows another approach to declaring and initializing, which can be done in only one line. int [][] intArr2D B = ((8,1,3,6,4,2), (7,9,2,0,5,1)); //Write out the contents of the second array. System.out.println(" A 2-row by 6-column 2-D Array of int 21. 22. 23. 24. 25. 26. 27. 28. } 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. } 40. 41. } 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. Values (Second Array)"); for (int i=0; i <2; i++) { for (int j=0; j <6; j++) { System.out.print(intArr20 B[i][j]+" "); System.out.println(); //Declare and initialize a three-dimensional array of int values with 3 (2-D) arrays of 2 rows and 3 columns. //This shows an approach to declaring and initializing a 3-D array, which can be done in only one line. int [][][] intArr3D = {{{4,8,1),(8,3,7}}, {{1,9,3), (2,8,6}}, ((4,3,8),(9,0,2)}}; //Write out the contents of the array. System.out.println(" A 3-array by 2-row by 3-column 3-D Array of int Values"); for (int i=0; i <3; i++) { System.out.println("Array "+i); for (int j=0; j <2; j++) { ulti-Dimensional Arrays JAVA-PROGRAMMING ACTIVITY 52. for (int k-8; k <3; k++) { System.out.print(intArr30[i][j][k]+" "); 53. 54. 55. System.out.println(); 56. 57. System.out.println(); 58. 59. 60. 3
Expert Answer:
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
software projects failed. In the run-up to Y2K, most of the world's large companies claimed that fixing the Millennium Bug was a large project whose success was critical to their survival. One would...
-
A regular language is a language that can be defined by a regular expression. 0 2 . 1 Complete the unshaded cells of Table 1 to show which of the statements about regular languages are true and which...
-
Each of the following passages may be plausibly criticized by some who conclude that it contains a fallacy, but each may be defended by some who deny that the argument is fallacious. Discuss the...
-
True, False, or Uncertain? Explain. a. A tax imposed on a good with relatively inelastic demand is borne primarily by the consumer. b. A tax imposed on a good with relatively elastic supply is borne...
-
For the 8-bit word 00111001, the check bits stored with it would be 0111. Suppose when the word is read from memory, the check bits are calculated to be 1101.What is the data word that was read from...
-
Determination of Accounting Income and Distribution. The Trotter Trust, a simple trust, has the receipts and expenditures listed below for the current year. Assume the Uniform Act governs an items...
-
Muldur Corporations comparative balance sheets are presented below. Additional information: 1. Net income was $18,300. Dividends declared and paid were $16,400. 2. Equipment which cost $10,000 and...
-
1. "Gregg Wiatt was stunned. On his 28th birthday-six months before the death of the man he had thought was his natural father-his mother told him the truth. She told him he was the offspring of a...
-
For the logistic regression, suppose we want to test HO: logit(pi(x) = Beta0 + Betal X1, versus H1: logit(pi(x) = beta0 + betalX1 + beta2 X2 using the likelihood ratio test (LRT). Under regularity...
-
Assume we have a machine where all instructions require the same amount of time to execute, and they execute instructions as a state machine with 10 stages. The maximum propagation delays are listed...
-
How code is organized can affect performance in a pipelined processor. Let us assume a pipelined version of the processor developed in the project, similar to what we discussed in class on Feb 14th....
-
1. Contrast the proper planning and sales techniques for a straight rebuy, modified rebuy, and new buy situation. 2. Define and compare each along with at least two differences in terms of the time...
-
Your team has created a new food item that has been accepted at four major grocery stores. You have decided to use P.O.P. advertising as a major part of your IBP campaign. Detail your P.O.P....
-
A line Segments has an endpoint (- 4, 9), and it's midpoint is at ( 4, 2 ). What is the ordered pair of the other endpoint OF the line segment? The other endpoint of the live segment is Type an...
-
Select one of the U.S. Federal Pay Regulations from. Then conduct additional research on one of the regulations. History of the Act Why it was created How it influenced the area of human resources...
-
The Heese Restaurant Group manufactures the bags of frozen French fries used at its franchised restaurants. Last week, Heeses purchased and used 101,000 pounds of potatoes at a price of $ 0.70 per...
-
Cold Appliances Pty Ltd makes refrigerators and is trying to determine the cost of its ending work in process. The accountant has put together the following data for the year ended 30 June 2025. Each...
-
Find five interesting facts in Table 1.1. TABLE 1.1 Basic Characteristics of Selected Countries GNP per capita Index of Openness Goods & Services 2009 Population Area (millions) (1,000s sq. km.) Avg....
-
An apparatus for measuring thermal conductivity employs an electrical heater sandwiched between two identical samples of diameter \(25 \mathrm{~mm}\) and length \(60 \mathrm{~mm}\), which are pressed...
Study smarter with the SolutionInn App