Using an array of numbers, find: a) The average b) The largest Value and its location Here is the declaration and initialization of the array float [] num = new float[5]; for(int i = 0; i < num.length; i++) num[i] = random(10); Solution: a) To get the average of any set of numbers we just add them all up (find the sum) then divide by the number of values. Step 1: Whats the sum? float sum = 0; for(int i=0; i < num.length; i++) sum = sum + num[i]; Step 2: Division! float avg = sum / num.length; println("The average is " + avg); ================================================ b) Find the largest Lets think this through, what would you do if you had 100 numbers and had to find the biggest one. Theres too many to just look at and pick out the biggest number. You have to go through one at a time and keep track of the biggest number you've seen so far. When you've reached the end, the biggest you have so far must be the biggest in the bunch of numbers. If we keep track of biggest so far, we need a variable. The question also asked for the location, so we need a variable fr that too. float biggestSoFar = num[0]; int biggestLocation = 0; I set them to the first value just to get it all started. Now we search! for(int i=0; i < num.length; i++){ if(num[i] > biggestSoFar){ //A new record biggest, time to update the variables! biggestSoFar = num[i]; biggestLocation = i; } } println("The biggest value is " + biggestSoFar + " at location " + biggestLocation);