import java.io.*;

public class BuchEingabeTastatur {
	
	private static BufferedReader in = new BufferedReader (
		new InputStreamReader(System.in));
	
	public static Buch readBuch() throws IOException {
		
		Buch b;
		
		do {
			String titel = "", isbn = "";
			System.out.print("Der Buchtitel: ");
			titel = in.readLine();
			System.out.print("Die ISBN:      ");
			isbn = in.readLine();

			try {
				b = new Buch(titel, isbn);
				return b;				
			} catch (FalscheIsbnException e) {
				System.err.println("Ungültige ISBN. Neue Eingabe:"  + e.getMessage());
			}
		} while (true);
	}
	
	public static void main(String[] args) {
		try {
			System.out.println("Mein Buch: " + readBuch());
		} catch(IOException e) {
		 	System.err.println("Ein-/Ausgabe-Fehler.");
		}
	}	
}
