// The colored box is a subclassof box...
class coloredBox extends box {
// new attribute color boxColor;
// new constructor
coloredBox(float _x, float _y, float _w, float _h, int _n, color _c) {
super(_x, _y, _w, _h, _n);
boxColor = _c;
} // coloredBox
void display() {
pushMatrix();
// draw the box
translate(x, y);
stroke(0);
fill(boxColor);
rect(0, 0, w, h);
// draw the balls in it
for (int i=0; i < balls.length; i++) {
balls[i].display();
}
popMatrix();
} // display()
} // class coloredBox