import java.util.Scanner;
import java.io.FileNotFoundException;
import java.io.File;

class Oct28 {
	public static void main(String[] args) {

		Box b1 = new Box(1,2,3);
		System.out.println(b1.toString());
		System.out.println(b1);

		Box b2 = new Box(1,2,3);
		Box b3 = new Box(2,3,4);

		boolean b1EqualsB2 = b1.equals(b2);
		System.out.println("b1 equals b2: " + b1EqualsB2);

		boolean b1EqualsB3 = b1.equals(b3);
		System.out.println("b1 equals b3: " + b1EqualsB3);

		// Read data from box.data and create instances
		// for each box

		Scanner fin = null;
		
		try {
			fin = new Scanner(new File("box.data"));
		}
		catch(FileNotFoundException e) {
			System.out.println("file not found");
			System.exit(0);
		}

		// by default the scanner's delimeters are white space
		fin.useDelimiter(",|\n");

		int numBoxes = fin.nextInt();
		System.out.println("Num boxes: " + numBoxes);

		Box[] boxes = new Box[numBoxes];
		
		for(int i = 0; i < numBoxes; i++) {
			int height = fin.nextInt();
			int width = fin.nextInt();
			int length = fin.nextInt();

			Box b = new Box(height, width, length);
			System.out.println(b);
			boxes[i] = b;
		}

		for(int i = 0; i < numBoxes; i++) {
			System.out.println(boxes[i]);
		}


	}
}
