{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

CodeLab 11.06.06 - CodeLab 11.06.06 printArray is a method...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CodeLab : 11.06.06 printArray is a method that accepts one argument, an array of int s. The method prints the contents of the array; it does not return a value. inventory is an array of int s that has been already declared and filled with values. Write a statement that prints the contents of the array inventory by calling the method printArray. printArray(inventory); Write the definition of a method printArray, which has one parameter, an array of int s. The method does not return a value. The method prints out each element of the array, on a line by itself, in the order the elements appear in the array, and does not print anything else. public void printArray(int[] s) { for(int i = 0; i < s.length; i++) { System.out.print(s[i]); System.out.println(); } } Declare and instantiate an array named scores of twenty-five elements of type int. int[] scores = new int[25]; Write a statement that declares an array named streetAddress that contains exactly eighty elements of type char. char[] streetAddress = new char[80]; Declare an array named a of ten elements of type int and initialize the elements (starting with the first) to the values 10, 20,..., 100 respectively. int[] a = {10, 20, 30, 40, 50, 60, 70, 80, 90, 100}; Declare an array named taxRates of five elements of type double and initialize the elements (starting with the first) to the values 0.10, 0.15, 0.21, 0.28, 0.31, respectively.
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}