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 Histogram(int[] values, int minIndex, int maxIndex, int maxLength){
this.values = new int[maxIndex +1]; // Allocate memory for a copy of the values array
this.minIndex = minIndex;
this.maxIndex = maxIndex;
this.maxLength = maxLength;
// Step 7: Find the largest number in values array for scaling length of bars
// Step 8: Copy data from values array to this.values array while scaling to maximum length of bars
// step 10:
// 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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!