exercise 2.2 is to iterate an ArrayList<Float>