An Incremental Approach to Develop a Program WHAT MUST main DO? So we look at "main", and start writing it. The method "main" is outlined to do 5 steps: (1) ask the user how many students are in the class. If the number input is negative, tell the user to resubmit a positive number. (2) ask the user if they want to input the numbers from the console or have the computer randomly generate them. (3) call the appropriate method ("generateRandom" for the computer and "generateUser" for user input). The methods return the array of scores. (4) output the histogram of the scores by calling "outputHistogram". (5) ask the user if they want to continue. If yes, go back to (1), if not, terminate the program. IMPLEMENT STEPS (1) , (2) AND (5) OF main So what we do is first implement steps (1) and (2) above. These are done within a while loop. I.e., if the user gives a negative number, then re-ask again until the user gives a positive input. If the user gives a positive number, then ask for which one they want. After writing these parts, we compile and run the program. We then test the program out by giving all possibilities of responses and see if they work correctly. If there is a mistake, then we fix them. IMPLEMENT STEPS (3) AND (4) OF main Having implemented steps (1) and (2), we start working on steps (3) and (4). We write up the code for both of these steps. Step (3) is just an if...then....else statment which calls the appropriate method. Step (4) is just one line which is call to the method outputHistogram. To test whether the proper method is called, we implement the methods of "generateRandom" and "generateUser" with just three lines in each. The first line is just the declaration of the array of scores of size 10. One line is just a System.out.println statement saying we are in the method, "We are in generate....". The other line just returns the array declared in the first line. We create the method of outputHistogram and put in one line, which is a System.out.println statement indicating we've arrived in the procedure. Note that the complete development of "main" has now been done. That is why this approach is called "top down" as you work your way from the top ("main") down to the other procedures ("generateUser", "generateRandom", and then "outputHistogram"). Then compile your program and run it. Check if it goes to the appropriate methods depending on the inputs given by the user. If this is the case, then "main" now works. DEVELOPING AND TESTING generateUser You go to your generateRandom and remove the last 2 lines you put in for testing "main". You keep the line which creates the array of size 10. Then initialize each of the elements of the array to be zero. Then ask the user for the n elements one-by-one and assign them to the proper index of the array. Make sure that they are between 1 and 100 before assigning them to the array. Finally return the array. Remember that you are to "echo" the input numbers to the console window as they are input in (via JOptionPane.) To test that they are assigned correctly, you should add a "for" loop in the method which will print out the 10 elements in the array. So, for example, if the input is 33 34 40, one should have the 3rd element of the array is 2 and the fourth is 1, with all of the others being zero. Test this several times with different input to verify that it works. Once you are convinced it works, remove the statements which print out the array before returning. These are just put in for testing purposes. DEVELOPING AND TESTING generateRandom This is done the same way as "generateUser" except you generate the numbers between 1 and 100 instead of asking the user. You check this out the same as with "generateUser. You try with small arrays first of all, echo the numbers generated, and print out the final result. This is easier to test then "generateUser" as you just have to verify that the numbers generated are between 1 and 100. Once you are convinced it works, remove all of the auxilary statments. DEVELOPING AND TESTING outputHistogram Once you know that the array of scores are correctly created for the input, you just need to generate the histogram. This is done with a nested "for" loop. You have to play around a little with this to get a nice output.