From 6b20e56bbef4e4dbfd1ae3d20d782a47a1a90f6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=95=D0=B2=D0=B3=D0=B5=D0=BD=D0=B8=D0=B9?= Date: Wed, 1 Jul 2026 12:00:18 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=BA=D1=82=D0=B8=D0=BA?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/TaskDemo.java | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/TaskDemo.java b/src/TaskDemo.java index f0e1d6d..81c2d48 100644 --- a/src/TaskDemo.java +++ b/src/TaskDemo.java @@ -2,21 +2,32 @@ public class TaskDemo { public static void main(String[] args) { - - Status currentStatus = Status.DRAFT; - System.out.println("Ваш лимит: " + printStatus(currentStatus)); + String[][] menu = { + {"Профиль", "Настройки"}, + {"Главная", "Каталог"}, + {"Корзина", "Оплата"} + }; + String target = "Каталог"; + System.out.println(java.util.Arrays.toString(masMenu(menu, target))); } - public static int printStatus (Status status) { - switch (status) { - case APPROVED: return 0; - case REVIEW: return 50; - case DRAFT: return 100; - } - return 0; + public static int[] masMenu(String[][] menu, String target) { + if (menu.length == 0 || menu[0].length == 0) { + return new int[]{-1, -1}; + }else { + for (int i = 0; i < menu.length; i++) { + for (int j = 0; j < menu[0].length; j++) { + if (menu[i][j].equals(target)) { + return new int[]{i, j}; + } + } + } + }return new int[]{-1, -1}; } + + } \ No newline at end of file