diff --git a/.idea/caches/deviceStreaming.xml b/.idea/caches/deviceStreaming.xml
new file mode 100644
index 00000000..5c94783a
--- /dev/null
+++ b/.idea/caches/deviceStreaming.xml
@@ -0,0 +1,1414 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml
index 4a633946..506f8fd6 100644
--- a/.idea/kotlinc.xml
+++ b/.idea/kotlinc.xml
@@ -1,7 +1,7 @@
-
+
diff --git a/.idea/libraries/KotlinJavaRuntime.xml b/.idea/libraries/KotlinJavaRuntime.xml
index fd739f41..25340ee9 100644
--- a/.idea/libraries/KotlinJavaRuntime.xml
+++ b/.idea/libraries/KotlinJavaRuntime.xml
@@ -1,12 +1,16 @@
-
+
+
+
+
+
@@ -14,6 +18,10 @@
+
+
+
+
@@ -21,6 +29,10 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/markdown.xml b/.idea/markdown.xml
new file mode 100644
index 00000000..c61ea334
--- /dev/null
+++ b/.idea/markdown.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 9c8e7400..2bfdeda2 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/src/main/kotlin/ArchiveScreen.kt b/src/main/kotlin/ArchiveScreen.kt
new file mode 100644
index 00000000..583842c8
--- /dev/null
+++ b/src/main/kotlin/ArchiveScreen.kt
@@ -0,0 +1,25 @@
+class ArchiveScreen {
+ private val archives = mutableListOf()
+ private val input = InputUtils()
+
+ fun show() {
+ Menu(
+ title = "СПИСОК АРХИВОВ",
+ items = archives,
+ itemToString = { archive -> archive.name },
+ onCreate = { createArchive() },
+ onSelect = { archive -> showNotes(archive) },
+ exitText = "Выход"
+ ).show()
+ }
+
+ private fun createArchive() {
+ val name = input.readString("Введите название архива:")
+ archives.add(Archive(name, mutableListOf()))
+ println("Архив '$name' создан!")
+ }
+
+ private fun showNotes(archive: Archive) {
+ NoteScreen(archive).show()
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/InputUtils.kt b/src/main/kotlin/InputUtils.kt
new file mode 100644
index 00000000..23fba00e
--- /dev/null
+++ b/src/main/kotlin/InputUtils.kt
@@ -0,0 +1,21 @@
+import java.util.Scanner
+
+class InputUtils {
+ private val scanner = Scanner(System.`in`)
+
+ fun readInt(): Int? {
+ val line = scanner.nextLine()
+ return line.toIntOrNull()
+ }
+
+ fun readString(prompt: String): String {
+ while (true) {
+ println(prompt)
+ val input = scanner.nextLine().trim()
+ if (input.isNotEmpty()) {
+ return input
+ }
+ println("Ошибка: поле не может быть пустым. Попробуйте снова.")
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/Main.kt b/src/main/kotlin/Main.kt
index aade54c5..3e19bf80 100644
--- a/src/main/kotlin/Main.kt
+++ b/src/main/kotlin/Main.kt
@@ -1,3 +1,5 @@
-fun main(args: Array) {
- println("Hello World!")
+fun main() {
+ println("Добро пожаловать в приложение 'Заметки'!")
+ ArchiveScreen().show()
+ println("Работа завершена.")
}
\ No newline at end of file
diff --git a/src/main/kotlin/Menu.kt b/src/main/kotlin/Menu.kt
new file mode 100644
index 00000000..6618892e
--- /dev/null
+++ b/src/main/kotlin/Menu.kt
@@ -0,0 +1,40 @@
+class Menu(
+ private val title: String,
+ private val items: MutableList,
+ private val itemToString: (T) -> String,
+ private val onCreate: () -> Unit,
+ private val onSelect: (T) -> Unit,
+ private val exitText: String = "Выход"
+) {
+ private val input = InputUtils()
+
+ fun show() {
+ while (true) {
+ println("\n--- $title ---")
+ println("0. Создать...")
+
+ items.forEachIndexed { index, item ->
+ println("${index + 1}. ${itemToString(item)}")
+ }
+
+ val exitIndex = items.size + 1
+ println("$exitIndex. $exitText")
+
+ println("\nВведите номер пункта:")
+
+ val choice = input.readInt()
+
+ if (choice == null) {
+ println("Ошибка: введите число.")
+ continue
+ }
+
+ when (choice) {
+ 0 -> onCreate()
+ exitIndex -> return
+ in 1..items.size -> onSelect(items[choice - 1])
+ else -> println("Такого пункта нет. Введите корректное число.")
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/Models.kt b/src/main/kotlin/Models.kt
new file mode 100644
index 00000000..a6b30b4b
--- /dev/null
+++ b/src/main/kotlin/Models.kt
@@ -0,0 +1,9 @@
+data class Note(
+ val title: String,
+ val content: String
+)
+
+data class Archive(
+ val name: String,
+ val notes: MutableList = mutableListOf()
+)
\ No newline at end of file
diff --git a/src/main/kotlin/NoteScreen.kt b/src/main/kotlin/NoteScreen.kt
new file mode 100644
index 00000000..08bfdbbe
--- /dev/null
+++ b/src/main/kotlin/NoteScreen.kt
@@ -0,0 +1,31 @@
+import java.util.Scanner
+
+class NoteScreen(private val archive: Archive) {
+ private val input = InputUtils()
+
+ fun show() {
+ Menu(
+ title = "Архив '${archive.name}': ЗАМЕТКИ",
+ items = archive.notes,
+ itemToString = { note -> note.title },
+ onCreate = { createNote() },
+ onSelect = { note -> viewNote(note) },
+ exitText = "Назад"
+ ).show()
+ }
+
+ private fun createNote() {
+ val title = input.readString("Введите название заметки:")
+ val content = input.readString("Введите текст заметки:")
+ archive.notes.add(Note(title, content))
+ println("Заметка '$title' создана!")
+ }
+
+ private fun viewNote(note: Note) {
+ println("\n--- Просмотр заметки ---")
+ println("Заголовок: ${note.title}")
+ println("Текст: ${note.content}")
+ println("\nНажмите Enter, чтобы вернуться назад...")
+ Scanner(System.`in`).nextLine()
+ }
+}
\ No newline at end of file