******************************************************************************* 0) Administrative - hw: 10.3 and 10.5 - A5 design handout - exams back 1) Last time- file I/O - do unfinished stuff - quiz 2) Go over 10.1-10.2 in groups 3) Highlights A. Array: stores a list of data under one variable name, in order - for related data of the same type - instead of n different variables, use an array of length n - what it looks like: (indices 0 to n-1) * array of MP3 names * array of lawsuit prices B. Declaring, allocating, and initializing arrays - type includes brackets (in either place) - two ways of allocating/initializing * do MP3s with initializer list * do lawsuit prices normally - index into the array to assign entries or retrieve them - note that constructing array does not set up values - types: array name is type double[], array[i] is type double C. Looping through the array - loop variable as array index, "data member" length * calculate average lawsuit price - arrays whose values are functions of their indices * perfect squares from 0 to 99 - variable-length arrays D. Storing objects in arrays - Strings are objects, so you've already seen this * make an array of Phantoms - entries are null until you use the object's constructor * show a NullPointerException - don't go past the end of the array * show an ArrayOutOfBoundsException - now you can go through the array to do something to each * show moving each one - type of array is Phantom[], type of array[i] is Phantom E. Searching arrays of objects - look through to find an object that you want * show looking for overlaps with JavaMuncher 4) Exercises A. Declare and initialize int[] fact where fact[i] = i! (length 10) int[] fact = new int[10]; fact[0] = 1; for (int i=1; i oldest.getAge()) oldest = turtles[i]; 5) Summary - creating and using arrays - putting objects in arrays *******************************************************************************