Copy the barGraph processing program in to your work repository.
Follow the following prompts. Place your answers at the top of your code using comments.
// is the inline comment symbol, used to comment a single line of code.
/* */ is the block comment symbol, anything between the two asterisks will be commented out, including newlines.
Task 0: Answer the following questions at the top of the processing file.
values is an array, the basic data structure that exists in Java. Data stored in an array are called elements. The position of an element in an array is called on index. The first index of any array is 0. On line 6, the array values is initialized. What the last index of values?
How can you determine the size of an array? Hint: You can find this in 2 spots in the code.
What syntax would you use to refer to the element at index 4 in values?
What does the randomArray function do?
Task 1
Fill in the drawBars function. It should go through the array and draw a bar graph based on the values in the array. The height of each bar should be equal to the value of the given element in the array. The width of each bar should be euqal to the barWidth parameter. It should look like this (bar heights will be different based on randomness):
If you have this working, try inverting the graph so all the bars start at the bottom like this:
Task 2
WWrite a new method: int arrayMax(int[] data). This method should return the index of the largest value in data. Modify drawBars so that the fill color of the bar for the largest value is different from the otehr bars.