package ru.job4j.tracker;

public class StubInput implements Input {
    private String[] answers;
    private int position = 0;

    public StubInput(String[] answers) {
        this.answers = answers;
    }

    public String ask(String questions) {
        return answers[position++];
    }

    public int ask(String question, int[] range) {
        int key = Integer.valueOf(this.ask(question));
        boolean exist = false;
        for (int value : range) {
            if (value == key) {
                exist = true;
                break;
            }
        }
        if (exist) {
            return key;
        } else {
            throw new MenuOutException("Please, enter number in range 0 - 6!");
        }
    }
}

@@ -584,57 +584,15 @@
 if (
+!
 exist)
- %7B%0A            return key;%0A        %7D else %7B
 %0A   
@@ -672,22 +672,32 @@
 %22);%0A        
-%7D
+return key;
 %0A    %7D%0A%7D%0A

task 35834