arrays

Arrays
toc Reference: pg 280-284, 292-297 chapter 8, CH

Define
An array is a sequence of values of the same type. An array is a fixed length data structure. Only one name is given to this data type.

Declare
 double [] scoresArray = new double[10];

 [] is the symbol for an array. scoresArray is the name of the array, the data type is double.  you can store decimal values in this array. Size of the array is 10 that means you can store 10 different values in this array.

Access, store
The index value starts at 0 and goes to one less than the size of the array. You can access data using the integer index  scoresArray [i] where i is the index You can store a value at any spot ( 4th spot)  scoresArray [3] = 92.5; You can store the same value in all of the array spots using a for loop  for (int i = 0; i scoresArray[i] = 34;

Display contents
for (int i = 0; i System.out.println(scoresArray[i] );

__Array Task Set#1 (CW)__

 * 1) create numArray of size 10 and fill with the value 999, display
 * 2) add 1 to each number in the above array, display
 * 3) generate 10 random values between 100-200 and replace in the above array, display
 * 4) display the array data in reverse order
 * 5) double each value in the array, display