Question: public class Histogram { private int [ ] values; private int minIndex; private int maxIndex; private int maxLength; / * * constructor for histogram drawing
public class Histogram
private int values;
private int minIndex;
private int maxIndex;
private int maxLength;
constructor for histogram drawing class
values: the array of integer values to draw
minIndex: the lowest index in the array for the range to draw
maxIndex: the highest index in the array for the range to draw
maxLength: the length of line to draw for the largest value
public Histogramint values, int minIndex, int maxIndex, int maxLength
this.values new intmaxIndex ; Allocate memory for a copy of the values array
this.minIndex minIndex;
this.maxIndex maxIndex;
this.maxLength maxLength;
Step : Find the largest number in values array for scaling length of bars
Step : Copy data from values array to this.values array while scaling to maximum length of bars
step :
draw vertical bar graph
Java Code in all the steps
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
