import java.io.*;

public class TTeller {
	private Teller tel;
	private class Thread1 implements Runnable {
		public void run() {
			while (true) {
				try {
					tel.verwerkTienTallen();
				} catch (InterruptedException e) {
					System.out.println("Thread1 gestopt");
				}
			}
		}
	}
	private class Thread2 implements Runnable {
		public void run() {
			BufferedReader din=new BufferedReader(new InputStreamReader(System.in));
			System.out.print("Geef waarden voor n: ");
			while (true) {
				int n=0;
				try {
					n=new Integer(din.readLine()).intValue();
				} catch (IOException e) {
					System.out.println("Thread2 gestopt");
				}
				tel.verhoog(n);
			}
		}
	}
	private void doTest() {
		tel=new Teller();
		Thread t1=new Thread(new Thread1());
		Thread t2=new Thread(new Thread2());
		t1.start();
		t2.start();
	}
	public static void main(String args[]) {
		TTeller t=new TTeller();
		t.doTest();
	}
}