Question: Histogram java code Please follow all the conditions listed below To receive full credit, The constant called MAX must be declared atop the main (
Histogram java code
Please follow all the conditions listed below
To receive full credit,
The constant called MAX must be declared atop the main method and effectively used in the program to generate random whole numbers from to inclusive. In general, avoid using 'magic numbers' in code because 'magic numbers' reduce codereadability. An integer constantvariable should not appear in the code except for possibly common integers, such as or
the main method must call the following four programmerdefined methods methods that you write:
an input nonvoid method that uses a Scanner object declared in the main method but does not declare any variables within the method to return a Random object that will be used to create random integers in a different method
another input nonvoid method that uses a Scanner object declared in the main method and a stringliteral but does not declare any variables within the method to return an integer representing the number of items to store in the histogram,
a process nonvoid method that uses a Random object, and a constant declared and instantiated in the main method and the integer that represents the number of items to store in the histogram and output an array representing the histogram and
an output void method that uses the array to display in ascending order by index its contents as a histogram: either an array of strings are simply printed or an array of singledigit integers must be displayed as a histogram.
the main method should only contain:
the Scanner object instantiation and assignment,
a primitive constant used to store the maximum whole number, exclusive, that can be generated by the RNG declaration,
a primitive variable used to store the number of items to store in the histogram declaration,
the four method calls to the programmerdefined methods the methods that you write and
one method call to the Scanner object that does not read from the input buffer!
the input nonvoid method called by the main method to return a Random object must call a different input nonvoid method that uses a Scanner object declared in the main method and a Stringobject literal representing a prompt for a seed but does not declare any variables within the method to return an integerprimitive that will be used to create the Random object in the calling method.
use the most appropriate loop, if necessary, to manage the array manipulation.
avoid using the 'break' command in loops often in conjunction with the 'true' "continuationcondition" in order to avoid "spaghetti code". Instead, add a "volatile continuationcondition" either a Boolean variable or a "relational equation" an equation that utilizes a relational operator etc. that is subject to change based upon the value of a variable which may be governed by userdefined input
the only Scanner object must be declared in the main method; do not move the Scanner object declaration nor declare another Scanner object in the program.
the program must contain multiple programmerdefined methods the methods that you write that complete the major steps of the program; each method should be focused on a singular task, and have a comment that gives a description of the method purpose.
every method should be preceded with a comment that includes a description of the method purpose and the value returned if applicable Comments should also be included in the body of each method.
The program must properly function with any nonnegative array size including a size of
The code should be written efficiently to
eliminate redundant coding and
eliminate variables used only once.
Use as few variables as possible.
Add a comment with your name, date, and program description at the top.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
