diff --git a/.idea/caches/deviceStreaming.xml b/.idea/caches/deviceStreaming.xml
new file mode 100644
index 00000000..05c51b5a
--- /dev/null
+++ b/.idea/caches/deviceStreaming.xml
@@ -0,0 +1,1670 @@
+
+
+
+
+
+
\ 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..cf905821 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,6 +1,5 @@
-
-
+
\ No newline at end of file
diff --git a/src/main/kotlin/ArchiveManagementMenu.kt b/src/main/kotlin/ArchiveManagementMenu.kt
new file mode 100644
index 00000000..6c643ad1
--- /dev/null
+++ b/src/main/kotlin/ArchiveManagementMenu.kt
@@ -0,0 +1,72 @@
+import java.util.Scanner
+
+class ArchiveManagementMenu(
+ private val archiveManager: ArchiveManager,
+ private val scanner: Scanner
+) {
+ private var archiveName = ""
+
+ fun show() {
+ println("Введите название архива для управления:")
+ val archiveName = scanner.nextLine()
+
+ if (!validateInput(archiveName, "Имя архива")) return
+
+ this.archiveName = archiveName
+
+ while (true) {
+ println("Выберите действие:")
+ println("1 — Добавить заметку")
+ println("2 — Просмотреть заметки")
+ println("3 — Выйти из меню архива")
+
+ val choice = scanner.nextLine()
+
+ when (choice) {
+ "1" -> addNote()
+ "2" -> viewNotes()
+ "3" -> return
+ else -> println("Неверный выбор. Попробуйте снова.")
+ }
+ }
+ }
+
+ private fun addNote() {
+ println("Введите заголовок заметки:")
+ val title = scanner.nextLine()
+
+ println("Введите текст заметки:")
+ val text = scanner.nextLine()
+
+ if (!validateInput(title, "Заголовок заметки")) return
+ if (!validateInput(text, "Текст заметки")) return
+
+ if (archiveManager.addNoteToArchive(archiveName, title, text)) {
+ println("Заметка успешно добавлена!")
+ } else {
+ println("Не удалось добавить заметку.")
+ }
+ }
+
+ private fun viewNotes() {
+ val notes = archiveManager.getNotes(archiveName)
+ if (notes.isEmpty()) {
+ println("В этом архиве пока нет заметок. Хотите добавить новую?")
+ return
+ }
+
+ println("Список заметок:")
+ notes.forEach { note ->
+ println("Заголовок: ${note.title}")
+ println("Текст: ${note.text}")
+ }
+ }
+
+ private fun validateInput(input: String, description: String): Boolean {
+ if (input.isEmpty()) {
+ println("Ошибка: $description не может быть пустым.")
+ return false
+ }
+ return true
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/ArchiveManager.kt b/src/main/kotlin/ArchiveManager.kt
new file mode 100644
index 00000000..267f5211
--- /dev/null
+++ b/src/main/kotlin/ArchiveManager.kt
@@ -0,0 +1,26 @@
+
+class ArchiveManager {
+ private val archives = mutableMapOf>()
+
+ fun createArchive(name: String): Boolean {
+ if (name.isBlank() || name in archives) {
+ return false
+ }
+ archives[name] = mutableListOf()
+ return true
+ }
+
+ fun getArchiveNames(): List = archives.keys.toList()
+
+ fun addNoteToArchive(archiveName: String, title: String, text: String): Boolean {
+ val archive = archives[archiveName]
+ if (archive == null || title.isBlank()) {
+ return false
+ }
+ archive.add(Note(title, text))
+ return true
+ }
+
+ fun getNotes(archiveName: String): List = archives[archiveName] ?: emptyList()
+
+}
\ No newline at end of file
diff --git a/src/main/kotlin/Main.kt b/src/main/kotlin/Main.kt
index aade54c5..4223d89f 100644
--- a/src/main/kotlin/Main.kt
+++ b/src/main/kotlin/Main.kt
@@ -1,3 +1,8 @@
-fun main(args: Array) {
- println("Hello World!")
+
+import java.util.Scanner
+
+fun main() {
+ val scanner = Scanner(System.`in`)
+ val archiveManager = ArchiveManager()
+ MainMenu(archiveManager, scanner).show()
}
\ 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..2b5cfa2f
--- /dev/null
+++ b/src/main/kotlin/Menu.kt
@@ -0,0 +1,68 @@
+
+import java.util.Scanner
+
+class MainMenu(private val archiveManager: ArchiveManager, private val scanner: Scanner) {
+ fun show() {
+ while (true
+ ) {
+ println("\n=== Главное меню ===")
+ println("1. Создать новый архив")
+ println("2. Просмотреть архивы")
+ println("3. Управление архивом")
+ println("4. Выйти из программы")
+
+ print("Выберите действие: ")
+ val choice = scanner.nextLine()
+
+ when (choice) {
+ "1" -> createArchive()
+ "2" -> viewArchives()
+ "3" -> archiveManagementMenu()
+ "4" -> {
+ println("До свидания!")
+ return
+ }
+ else -> println("Неверное действие. Попробуйте снова.")
+ }
+ }
+ }
+
+ private fun createArchive() {
+ print("Введите название архива: ")
+ val name = scanner.nextLine()
+
+
+ if (name.isNullOrEmpty()) {
+ println("Ошибка: Имя не может быть пустым.")
+ return
+ }
+
+
+ if (name in archiveManager.getArchiveNames()) {
+ println("Такой архив уже существует.")
+ return
+ }
+
+
+ if (archiveManager.createArchive(name)) {
+ println("Архив создан успешно.")
+ } else {
+
+ println("Произошла ошибка при создании архива.")
+ }
+ }
+
+ private fun viewArchives() {
+ val archives = archiveManager.getArchiveNames()
+ if (archives.isNotEmpty()) {
+ println("Список архивов:")
+ archives.forEach { println(it) }
+ } else {
+ println("Архивы не найдены.")
+ }
+ }
+
+ private fun archiveManagementMenu() {
+ ArchiveManagementMenu(archiveManager, scanner).show()
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/Note.kt b/src/main/kotlin/Note.kt
new file mode 100644
index 00000000..8e77e29f
--- /dev/null
+++ b/src/main/kotlin/Note.kt
@@ -0,0 +1 @@
+data class Note(var title: String, var text: String)
\ No newline at end of file