background(200); size(300,300); IntList inventory; inventory = new IntList(); inventory.append(23); inventory.append(6); inventory.append(33); inventory.append(12); inventory.append(41); inventory.append(4); inventory.append(5); inventory.append(35); inventory.append(15); inventory.append(22); int sum=0; stroke(130); for(int i=0; i<=10; i++){ line(width/30+i*7*width/75,height/30,width/30+i*7*width/75,29*height/30); line(width/30,height/30+i*7*height/75,29*width/30,height/30+i*7*height/75); } stroke(0); for(int count=0; count<10; count++){ int leng=inventory.get(count); sum=sum+leng; fill(30,60+10*count,30); rect(width/30,height/30+count*7*height/75,leng*width/45,7*height/75); noFill(); } float mean = sum/10; line(width/30,height/60,width/30,59*height/60); line(width/60,29*height/30,59*width/60,29*height/30); stroke(255,0,0); strokeWeight(3); line(width/30+(mean*width/45),height/30,width/30+(mean*width/45),29*height/30); save("assignment2.png");