This assignment is a modification of Programming Projects 6.4 and 6.5 on page 375 of our textbook. Instead of having your program "read in an arbitrary number of integers that are in the range from 1 to 100 inclusive", your program should randomly generate the integers from 1 to 100 and your program should prompt the user for the number of random integers to generate. Also, instead of creating a histogram with 10 bars, create one with 25 bars, so the bars represent the ranges 1-4, 5-8, 9-12, etc. You do not need to label the histogram bars on the left edge, as in the figure on page 375. Notice that if a user asks for a very large number of randomly generated integers, some histogram bars may be wider than the screen. So you should scale the histogram bars so that the longest bar fits on one row of the screen. Do not do as in Project 6.5, where every asterisk always represents five values. You should compute a minimum scaling factor for the histogram, so that each asterisk represents only enough values so that the longest histogram bar fits in one row.
For generating the random numbers, use the Your program should continue to prompt the user for a sample size, generate the random data, and draw the histogram until the user inputs a sample size of 0.
This assignment can be done with just one file. You can put all of your code into the main method or in static helper methods. You can download this This assignment is due Wednesday, November 12.
|