Create a new class named E1P1 Create the Main “Stub" through Eclipse. Bob is an economist and he loves data. In fact, he wants you to generate even more data for him. The E-indicator ranges between 100 and 599. Write a program that generates 25 random measurements in that range and create a report as follows. Write a value returning method that determines the category for a specific month. Use variables as appropriate. No magic numbers. Output should be like the following: The category numbers should be as shown in the chart at bottom. E-Indicator Data Category <#> Category <#> Category <#> Category <#> Month 1 ## Month 2 ## Month 3 ## Month 4 ## Include all months 1 through 25 in your output Category <#> Category <#> Month 22 ## Month 23 ## ## Category <#> Category <#> Month 24 Month 25 ## Distribution Summary #%# Category 1 count Category 2 count Category 3 count Category 4 count Category 5 count 100-199 This should show a count of 200-299 ## how many measurements #%# ## ## 300-399 were in each category. 400-499 500-599 Average of all months ###.#
Step 1 : Start
Step 2 : Create a method getCategory() which accepts a number and returns it's respective category it belongs to to the main calling method.
Step 3 : In the main method create a for loop and generate 25 random numbers using the random class and storing the in an array of integers.
Step 4 : Add the numbers together for further average calculation.
Step 5 : Incrementing the Category Counter Array according to the number generated using an if else if statement.
Step 6 : Compute the average of all the numbers generated.
Step 7 : Using a for loop print the Month Number , E-Indicator Numbers and the category it belongs to by calling the getCategory() method and passing the number.
Step 8 : Print the category distribution by printing the Category Number and the Count of the Numbers in each category.
Step 9 : Print the average of all the randomly generated numbers.
Step 10 : Stop
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 8 images