CS 111 - 11/8/12 Tuesday 11/13 - Project 3 Due Tuesday 11/13 - Exam 2 Extra Credit Questions Due Thursday 11/15 - Exam 2 Same format as last exam - 20 multiple choice questions - 2 write code/method questions Topics: - Pictures manipulation - Looping: while, for - If statements - Relational operators - Boolean operators - return values from methods Today is the CS Scavenger Hunt 4:45pm ============================= Arrays - to allow multiple data values to be stored using a single variable name. int array1[]; int[] array2; array1 = new int[10]; int array3[] = new int [10000]; int size = 500; //size = SimpleInput.getIntNumber("Enter an integer"); array2 = new int [size]; To use an array, we again use the [] operator to specify a position in the array. array1 [3] = 574; For an array of size N, the valid "subscripts"/"positions" range from 0 to N-1 int i; for (i = 0 ; i < 10 ; ++i) { array1[i] = 0; } for (i = 0 ; i < array1.length ; ++i) { array1[i] = 0; } for (i = 0 ; i < array3.length ; ++i) { array3[i] = SimpleInput.getIntNumber("Enter an integer"); } for (i = 0 ; i < array1.length ; ++i) { System.out.println ("Array1[" + i + "] is " + array1[i]); }