package ru.matevosyan.start;

import java.util.Scanner;

/**
 * Class BasicAction implements interface UserAction.
 * Created for override key and info methods in this class.
 * Created on 07.12.2016.
 * @since 1.0
 * @version 1.0
 * @author Matevosyan Vardan
 */

public class ConsoleInput implements Input {

    /**
     * variable scanner for reading user input data.
     */

    private Scanner scanner = new Scanner(System.in);

    /**
     * Override interface Inputs method ask.
     * @param question use for showing messages to user
     * @return user reading data
     */

    @Override
    public String ask(String question) {

        System.out.print(question);
        return scanner.nextLine();

    }

    @Override
    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("Out of menu range. ");
        }

    }

    @Override
    public int ask(Tracker tracker) {
        int userId = Integer.valueOf(ask("Please enter the Task's id: "));
        int id;
        boolean exist = false;

        for (int i = 0; i < tracker.getAll().length; i++) {
           id = Integer.parseInt(tracker.getAll()[i].getId());
            if (id == userId) {
                exist = true;
                break;
            }
        }

        if (exist) {
            return userId;
        } else {
            throw new IdExistException("Such item with this id does not exist. Please try again");
        }
    }
}

@@ -770,32 +770,55 @@
 n, int%5B%5D range) 
+throws MenuOutException
 %7B%0A        int ke
@@ -1213,24 +1213,72 @@
 ask(
-Tracker tracker)
+String question, String%5B%5D rangeIds) throws NumberFormatException
  %7B%0A 
@@ -1284,19 +1284,22 @@
         
+Str
 in
-t
+g
  userId 
@@ -1304,166 +1304,95 @@
 d = 
-Integer.valueOf(ask(%22Please enter the Task's id: %22));%0A        int id;%0A        boolean exist = false;%0A%0A        for (int i = 0; i %3C tracker.getAll().length; i++
+ask(question);%0A        boolean exist = false;%0A%0A        for (String gettingId : rangeIds
 ) %7B%0A
@@ -1403,20 +1403,19 @@
        i
-d = 
+f (
 Integer.
@@ -1427,67 +1427,47 @@
 Int(
-tracker.getAll()%5Bi%5D.getId());%0A            if (id == 
+gettingId) == Integer.parseInt(
 userId)
+)
  %7B%0A 
@@ -1583,22 +1583,40 @@
  return 
+ Integer.valueOf(
 userId
+)
 ;%0A      
@@ -1652,14 +1652,19 @@
 new 
-IdExis
+NumberForma
 tExc

edit second method