package ru.matevosyan.start;

/**
 * Created for valid input data.
 * Created on 27.12.2016.
 * @since 1.0
 * @version 1.0
 * @author Matevosyan Vardan
 */

public class ValidateInput extends ConsoleInput {

    public int ask(String question, int[] range) {

        boolean invalid = true;
        int value = -1;

        do {
            try {
                value = super.ask(question, range);
                invalid = false;
            } catch (MenuOutException moe) {
                System.out.println("Please select key from menu");
            } catch (NumberFormatException nfe) {
                System.out.println("Please enter validate data again");
            }
        } while (invalid);

        return value;
    }
}


@@ -730,11 +730,548 @@
 ;%0A    %7D%0A
+%0A    public int ask(Tracker tracker) %7B%0A        boolean invalid = true;%0A        int value = -1;%0A%0A        do %7B%0A            try %7B%0A                value = super.ask(tracker);%0A                invalid = false;%0A            %7D catch (IdExistException iee) %7B%0A                System.out.println(%22Such item with this id does not exist. Please try again%22);%0A            %7D catch (NumberFormatException nfe) %7B%0A                System.out.println(%22Please enter validate data again%22);%0A            %7D%0A        %7D while (invalid);%0A%0A        return value;%0A    %7D%0A%0A
 %7D%0A%0A

edit ValidateInput.java