size(300,300); background(220); int graphX = width/10; int graphY = height/10; int rectH = (height-2*graphY)/10; int factor = (width-2*graphX)/100; int a = factor*50; int b = factor*75; int c = factor*48; int d = factor*39; int e = factor*82; int f = factor*55; int g = factor*65; int j = factor*33; int l = factor*77; int m = factor*100; for(int i=graphX; i<(width-graphX);i=i+rectH){ for(int k=graphY;k<(height-graphY);k=k+rectH){ stroke(150); fill(220); rect(i,k,rectH,rectH); } } stroke(0); strokeWeight(2); line(graphX,graphY/2,graphX,(height-graphY/2)); line(graphX/2,(height-graphY),(width-graphX/2),(height-graphY)); graphY = height-graphY-rectH; fill(0,0,220); rect(graphX,graphY,a,rectH); graphY = graphY-rectH; fill(0,0,210); rect(graphX,graphY,b,rectH); graphY = graphY-rectH; fill(0,0,200); rect(graphX,graphY,c,rectH); graphY = graphY-rectH; fill(0,0,180); rect(graphX,graphY,d,rectH); graphY = graphY-rectH; fill(0,0,160); rect(graphX,graphY,e,rectH); graphY = graphY-rectH; fill(0,0,140); rect(graphX,graphY,f,rectH); graphY = graphY-rectH; fill(0,0,120); rect(graphX,graphY,g,rectH); graphY = graphY-rectH; fill(0,0,100); rect(graphX,graphY,j,rectH); graphY = graphY-rectH; fill(0,0,85); rect(graphX,graphY,l,rectH); graphY = graphY-rectH; fill(0,0,60); rect(graphX,graphY,m,rectH); float mean = (a+b+c+d+e+f+j+g+l+m)/10.0; float lineX = graphX + mean; stroke(240,0,0); line(lineX, graphY, lineX, (height-graphY)); fill(220,0,0); text("mean = "+mean,width/2,(height-graphY/2)); save("assignment_2.png");