Need help for java code...
Method called printGraph() that takes as a parameter an array of integers. Each
integer will be between 0 and 100. The method should print a horizontally oriented bar graph of the values, using ‘=’ characters to produce bars. Each value should be divided
By 10 and that many equals characters printed (so the maximum length of a bar will be 10 characters for a value of 100).
The actual value of the bar should be printed following a space at the end of each line.
So, for example, if the argument to printGraph() is { 14, 65, 39, 99 } then the output should look like this
= 14
====== 65
=== 39
========= 99
My answer was
int printGraph(int [] args)
{
int size=0;
int length, j;
For(length = 1; length <= size; length++){
For(j = 1; j <= length; j++)
Print("=");
Println(size);` ` `
}
Return length;
}
}
Help me with codas...