Question: Program 1 , Histogram , takes an integer n , and two integers left and right, and uses StdDraw to plot a histogram of the
Program Histogram takes an integer n and two integers left and right, and uses StdDraw to plot a histogram of the count of the numbers in the standard input stream that fall in each of the n intervals defined by dividing left right into n equalsized intervals.
Note: The program is to read the values from an input file whose first line would contain nleft and right values. The remaining lines would contain the sequence of integer values.
A sample run would be as follows. Please note that the program would read the input data from a file whose name is specified via the redirection operator
more data.txt
java Histogram data.txt
It should plot a histogram where the xaxis points are and the intervals are The height of the rectangles for the intervals should be respectively.
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
