Purpose: This program will generate a series of random numbers and produces a table containing these values and some statistics about them.
- The program should define a Header and Data format string to output results as shown in the sample at the bottom.
- The program will get from the user the maximum random number to be computed (an integer). It will get this value into a String variable.
- The program will use the Integer wrapper class to parse the integer out of the String and store in an integer variable.
- Then the program will ask the user how many random numbers will be generated. It should also receive this number in a String and use the Integer wrapper class to get the integer into an integer variable.
- Using a for loop, output a table with the following characteristics:
o Print a header of titles using a header format and printf (this should be before the loop, not inside the loop).
o There should be one line per each random line generated.
o Each line should contain:
§ A line number, also known as round.
§ The generated random number.
§ Current Maximum of all generated random numbers so far.
(Utilize Math class to determine current Max)
§ Current Minimum of all generated random numbers so far.
(Utilize Math class to determine current Min)
§ Current Total of all generated random numbers so far added together.
(Total should be calculate using a compound operator)
§ Current average of all generated random numbers so far.
(Average should be shown with 2 decimal places)
- Output “End Run…” after all lines have been output.