Note: Please keep the programs that you create today, in case you have a question about your grades for the ICEs at the end of the quarter. When you're working with a partner, each person should save his-or-her own copy.
ICE 19.1: Filling An Array With Input: Processing Elements Of An Array
Download the file named ParamReturnValuePractice.java, and fill in the bodies for each of the given methods.
Be prepared to explain why you made the choices you did, and why those choices are better than any alternatives.
HINT: Pay special attention to the comments sprinkled throughout.These will aid you in determining what types of methods to construct.
When you get done with this exercise, go on to the next section.
ICE 19.2: Filling An Array With Input: Processing Elements Of An Array
Create a method that will return an array of integers named FillArray().
This method should start by asking the user how many integers the user wants to type in, and then create an array big enough to hold all those numbers.
Next the method should ask the user for that many numbers, storing one response in each slot.
Lastly, the method should return the array to the caller.
In main, call up this new method, and save the response using a local variable. Then pass the array that you got from FillArray() to PrintArray().
Use the provided ICE_18_FillArray.java as a starting point (this file was used the previous Lecture's ICE) and fill in the missing parts (in the FillArray() method).
Notice that main calls the PrintArray method that you created in the prior part of these ICEs – you should copy that method into the ArrayBot class that's here.
HINT: A "solution" to ICE_18_FillArray.java is posted under the previous Lecture tab as Arrays_as_Parameters_Part2_SOLUTION.java so you don't have to "reinvent the wheel" if you don't have your own "solution" to this file.
When you get done with this exercise, show your Instructor, then go on to the next section.
Part 3: Practice: Processing All Elements Of An Array
Download the Lec13_Part3.java file. Create an array of doubles that has space enough for ten separate values.
First, write a while loop that will set the value of the ten (10) elements of your array to the numbers 5 through 14, then write a for loop that will print out just the first 5 elements of your array.
When you get done with this exercise, show your Instructor.