package ru.job4j.Tracker;

import java.util.Scanner;

/**
 * Created by Comp on 12.06.2017.
 */
public class StartUI {
    private static int num;
    private Input input;
    private Tracker tracker;

    public StartUI(Input input, Tracker tracker) {
        this.input = input;
        this.tracker = tracker;
    }

    /*public void printAll() {
        Item[] inputs = tracker.findAll();
        for (int i = 0; i < ; i++) {

        }
    }*/

    public void init() {
        System.out.println("0. Add new Item;");
        System.out.println("1. Show all items;");
        System.out.println("2. Edit item;");
        System.out.println("3. Delete item;");
        System.out.println("4. Find item by Id;");
        System.out.println("5. Find items by name;");
        System.out.println("6. Exit Program.");

        num = Integer.valueOf(this.input.ask("Select: "));

        switch (num) {
            case 0:
                System.out.println("Введите имя");
                Scanner scanner = new Scanner(System.in);
                String id = scanner.nextLine();
                String key = scanner.nextLine();
                String name = scanner.nextLine();
                String comments = scanner.nextLine();
                Long creat = System.currentTimeMillis();
                Item item = new Item(key, id, name, comments, creat);
                tracker.add(item);
                break;
            case 1:
                tracker.findAll();
                break;
            case 2:
                System.out.println("Введите id пользователя: ");
                Scanner scanner1 = new Scanner(System.in);
                String id1 = scanner1.nextLine();
                String key1 = scanner1.nextLine();
                String name1 = scanner1.nextLine();
                String comments1 = scanner1.nextLine();
                Long creat1 = System.currentTimeMillis();
                Item item1 = new Item(key1, id1, name1, comments1, creat1);
                tracker.update(item1);
                String c = scanner1.nextLine();
            case 3:
                System.out.println("Введите id пользователя: ");
                Scanner scanner2 = new Scanner(System.in);
                String id2 = scanner2.nextLine();
                tracker.delete(id2);
                //String d = scanner.nextLine();
            case 4:
                System.out.println("Введите id пользователя: ");
                Scanner scanner3 = new Scanner(System.in);
                String id3 = scanner3.nextLine();
                tracker.findById(id3);
                //String e = scanner.nextLine();
            case 5:
                System.out.println("Введите имя пользователя: ");
                Scanner scanner4 = new Scanner(System.in);
                String name2 = scanner4.nextLine();
                tracker.findByName(name2);
                //String g = scanner.nextLine();
            case 6:
                Scanner scanner5 = new Scanner(System.in);
                System.out.println("Выйти из программы: ");
                if (scanner5.equals("y")) {
                    break;
                } else {
                    return;
                }
        }
    }

    public static void main(String[] args) {
        Tracker tracker = new Tracker();
        Input inputCons = new ConsoleInput();
        new StartUI(inputCons, tracker).init();
    }
}

@@ -455,20 +455,19 @@
  public 
-void
+int
  init() 
@@ -2933,16 +2933,76 @@
 case 6:%0A
+                System.out.println(%22%D0%92%D1%8B%D0%B9%D1%82%D0%B8 %D0%B8%D0%B7 %D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC%D1%8B: %22);%0A
         
@@ -3073,48 +3073,40 @@
    S
-ystem.out.println(%22%D0%92%D1%8B%D0%B9%D1%82%D0%B8 %D0%B8%D0%B7 %D0%BF%D1%80%D0%BE%D0%B3%D1%80%D0%B0%D0%BC%D0%BC%D1%8B: %22
+tring name3 = scanner5.nextLine(
 );%0A 
@@ -3124,24 +3124,21 @@
     if (
-scanner5
+name3
 .equals(
@@ -3223,16 +3223,23 @@
   return
+ init()
 ;%0A      
@@ -3260,23 +3260,40 @@
       %7D%0A
+        return 0;%0A
     %7D%0A
-%0A
     publ

change StartUI