/**
 *  Class to work with Box class:  store items in boxes.
 */
public class PackItems {
    /** Run the test */
    public static void main(String[] args) {
	int[] boxcap = {100,100,50,200,250};
	int[] items = {10,25,50,50,30,30,50,40,10,50,10,50,40};
	int i, j;

	// create boxes
	Box[] boxes = new Box[boxcap.length];
	for (i = 0; i <= boxcap.length; i++) {
	    boxes[i] = new Box(boxcap[i]);
	}

	// add items to boxes
	i = 0;  // box index
	j = 0;  // item index
	while (j < items.length) {
	    boxes[i].add(items[j]);
	    j++;
	}

	// print items in boxes
	for (i = 0; i < boxes.length; i++) {
	    for (j = 0; j < items.length; j++) {
		System.out.printf("Box %d item %d: size %d.\n",
				  i,j,boxes[i].getItem(j));
	    }
	    boxes[i].printUsage();
	}
    }
}
