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

class Apr1 {

	public static void main(String[] args) {

		Scanner input = null;

		try {
			File f = new File("numbers.txt");
			input = new Scanner(f);		
		}
		catch (FileNotFoundException e) {
			System.out.println("File not found");
			return;
		}

		int count = input.nextInt();
		System.out.println("count: " + count);

		int[] numbers = new int[count];

		for(int i = 0; i < count; i++) {
			numbers[i] = input.nextInt();
		}

		printArray(numbers);

		input.close();

		// read and print names

		
		try {
			File f = new File("names.txt");
			input = new Scanner(f);		
		}
		catch (FileNotFoundException e) {
			System.out.println("File not found");
			return;
		}

		while(input.hasNext()) {
			System.out.println(input.nextLine());
		}

		input.close();

		// write 
				
		PrintWriter pw = null;

		try {
			File f = new File("output.txt");
			pw = new PrintWriter(f); 
		}
		catch (FileNotFoundException e) {
			System.out.println("Output file not found");
			return;	
		}

		pw.println("hello world!");
		pw.printf("count: %d\n", count);
		pw.print("1 ");
		pw.print("2\n");

		pw.close();		

		// read in data and create 3 Box objects
		
		try {
			File f = new File("boxes.txt");
			input = new Scanner(f); 
		}
		catch (FileNotFoundException e) {
			System.out.println("Boxes file not found");
			return;	
		}

		Box[] boxes = new Box[3];

		for(int i = 0; i < 3; i++) {
			int w = input.nextInt();
			int l = input.nextInt();
			int h = input.nextInt();
			Box b = new Box(w,l,h);
			boxes[i] = b;
		}		

		for(Box b : boxes) {
			System.out.println(b);
		}

	}
	
	static void printArray(int[] arr) {
		for(int elm : arr) {
			System.out.print(elm + " ");
		}
		System.out.println();
	}
}
