HW09 Solution1

HW09 Solution1 - if (0 <= index...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 public class BarGraph { private int[] counts private String[] names public BarGraph(String[] setNames) { names = new String[setNames.length] counts = new int[setNames.length] for (int i = 0 i < setNames.length i++) names[i] = setNames[i] } public void setCount(int index, int quantity) {
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: if (0 &lt;= index &amp;&amp; index &lt; counts.length) counts[index] = quantity } public void printGraph() { for (int i = 0 i &lt; counts.length i++) { for (int j = 0 j &lt; counts[i] j++) System.out.print(&quot;*&quot;) System.out.println(&quot; (&quot; + counts[i] + &quot; &quot; + names[i] + &quot;)&quot;) } } }...
View Full Document

Ask a homework question - tutors are online