From 8d9c4d53e4a4d0d1a7906765e61d1456f500573b Mon Sep 17 00:00:00 2001
From: Timmmmofey <153191260+Timmmmofey@users.noreply.github.com>
Date: Tue, 29 Oct 2024 22:07:54 +0300
Subject: [PATCH 1/3] =?UTF-8?q?=D0=9B=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82?=
=?UTF-8?q?=D0=BE=D1=80=D0=BD=D0=B0=D1=8F=20=E2=84=9613?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
students/23K1302/23K1302-p13/pom.xml | 13 +++++++
.../java/ru/mirea/practice/s0000001/Ex1.java | 37 +++++++++++++++++++
.../ru/mirea/practice/s0000001/Person.java | 33 +++++++++++++++++
students/23K1302/pom.xml | 1 +
4 files changed, 84 insertions(+)
create mode 100644 students/23K1302/23K1302-p13/pom.xml
create mode 100644 students/23K1302/23K1302-p13/src/main/java/ru/mirea/practice/s0000001/Ex1.java
create mode 100644 students/23K1302/23K1302-p13/src/main/java/ru/mirea/practice/s0000001/Person.java
diff --git a/students/23K1302/23K1302-p13/pom.xml b/students/23K1302/23K1302-p13/pom.xml
new file mode 100644
index 000000000..4facf8509
--- /dev/null
+++ b/students/23K1302/23K1302-p13/pom.xml
@@ -0,0 +1,13 @@
+
+
+ 4.0.0
+
+ 23K1302
+ ru.mirea.practice
+ 2024.1
+ ../pom.xml
+
+ 23K1302-p13
+ Задание 13
+
diff --git a/students/23K1302/23K1302-p13/src/main/java/ru/mirea/practice/s0000001/Ex1.java b/students/23K1302/23K1302-p13/src/main/java/ru/mirea/practice/s0000001/Ex1.java
new file mode 100644
index 000000000..ae848bbfe
--- /dev/null
+++ b/students/23K1302/23K1302-p13/src/main/java/ru/mirea/practice/s0000001/Ex1.java
@@ -0,0 +1,37 @@
+package ru.mirea.practice.s0000001;
+
+import java.util.Locale;
+
+public final class Ex1 {
+
+ private Ex1() {
+ // 123
+ }
+
+ public static void main(String[] args) {
+
+ String str = "I like Java!!!";
+
+ System.out.println("1. Исходная строка: " + str);
+
+ System.out.println("2. Последний символ: " + str.charAt(str.length() - 1));
+
+ System.out.println("3. Заканчивается на '!!!': " + str.endsWith("!!!"));
+
+ System.out.println("4. Начинается с 'I like': " + str.startsWith("I like"));
+
+ System.out.println("5. Содержит 'Java': " + str.contains("Java"));
+
+ System.out.println("6. Позиция 'Java': " + str.indexOf("Java"));
+
+ String replacedStr = str.replace('a', 'o');
+ System.out.println("7. Замена 'a' на 'o': " + replacedStr);
+
+ System.out.println("8. В верхнем регистре: " + str.toUpperCase(Locale.ROOT));
+
+ System.out.println("9. В нижнем регистре: " + str.toLowerCase(Locale.ROOT));
+
+ String substringStr = str.substring(0, str.indexOf("Java")) + str.substring(str.indexOf("Java") + 4, str.length() - 1);
+ System.out.println("10. Вырезанная подстрока 'Java': " + substringStr);
+ }
+}
diff --git a/students/23K1302/23K1302-p13/src/main/java/ru/mirea/practice/s0000001/Person.java b/students/23K1302/23K1302-p13/src/main/java/ru/mirea/practice/s0000001/Person.java
new file mode 100644
index 000000000..47087d6a2
--- /dev/null
+++ b/students/23K1302/23K1302-p13/src/main/java/ru/mirea/practice/s0000001/Person.java
@@ -0,0 +1,33 @@
+package ru.mirea.practice.s0000001;
+
+public class Person {
+
+ private String lastName;
+ private String firstName;
+ private String middleName;
+
+ public Person(String lastName, String firstName, String middleName) {
+ this.lastName = lastName;
+ this.firstName = firstName;
+ this.middleName = middleName;
+ }
+
+ public String getFullName() {
+ StringBuilder fullName = new StringBuilder(lastName);
+ if (firstName != null && !firstName.isEmpty()) {
+ fullName.append(" ").append(firstName.charAt(0)).append(".");
+ }
+ if (middleName != null && !middleName.isEmpty()) {
+ fullName.append(" ").append(middleName.charAt(0)).append(".");
+ }
+ return fullName.toString();
+ }
+
+ public static void main(String[] args) {
+ Person person1 = new Person("Мясников", "Тимофей", "Михайлович");
+ Person person2 = new Person("Михаил", "Мясников", null);
+
+ System.out.println("Полное имя первого человека: " + person1.getFullName());
+ System.out.println("Полное имя второго человека: " + person2.getFullName());
+ }
+}
diff --git a/students/23K1302/pom.xml b/students/23K1302/pom.xml
index c118d8bd0..e7ace9dab 100644
--- a/students/23K1302/pom.xml
+++ b/students/23K1302/pom.xml
@@ -26,5 +26,6 @@
23K1302-p10
23K1302-p11
23K1302-p12
+ 23K1302-p13
From dc0c829df6721a105cc332138e8176dcff380886 Mon Sep 17 00:00:00 2001
From: Timmmmofey <153191260+Timmmmofey@users.noreply.github.com>
Date: Tue, 29 Oct 2024 22:30:37 +0300
Subject: [PATCH 2/3] =?UTF-8?q?=D0=9B=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82?=
=?UTF-8?q?=D0=BE=D1=80=D0=BD=D0=B0=D1=8F=20=E2=84=9614?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
students/23K1302/23K1302-p14/pom.xml | 13 +++++++
.../java/ru/mirea/practice/s0000001/Main.java | 39 +++++++++++++++++++
students/23K1302/pom.xml | 1 +
3 files changed, 53 insertions(+)
create mode 100644 students/23K1302/23K1302-p14/pom.xml
create mode 100644 students/23K1302/23K1302-p14/src/main/java/ru/mirea/practice/s0000001/Main.java
diff --git a/students/23K1302/23K1302-p14/pom.xml b/students/23K1302/23K1302-p14/pom.xml
new file mode 100644
index 000000000..533bbfcfd
--- /dev/null
+++ b/students/23K1302/23K1302-p14/pom.xml
@@ -0,0 +1,13 @@
+
+
+ 4.0.0
+
+ 23K1302
+ ru.mirea.practice
+ 2024.1
+ ../pom.xml
+
+ 23K1302-p14
+ Задание 14
+
diff --git a/students/23K1302/23K1302-p14/src/main/java/ru/mirea/practice/s0000001/Main.java b/students/23K1302/23K1302-p14/src/main/java/ru/mirea/practice/s0000001/Main.java
new file mode 100644
index 000000000..e0a017e36
--- /dev/null
+++ b/students/23K1302/23K1302-p14/src/main/java/ru/mirea/practice/s0000001/Main.java
@@ -0,0 +1,39 @@
+package ru.mirea.practice.s0000001;
+
+import java.util.regex.Pattern;
+
+public final class Main {
+
+ private Main() {
+ // 123
+ }
+
+ public static void splitString(String input, String regex) {
+ Pattern pattern = Pattern.compile(regex);
+ String[] parts = pattern.split(input);
+ System.out.println("Строка до разбивки: " + input);
+ System.out.println("Результат разбивки строки:");
+ for (String part : parts) {
+ System.out.println(part);
+ }
+ }
+
+ public static boolean isValidString(String input) {
+ String regex = "^abcdefghijklmnopqrstuv18340$";
+ return Pattern.matches(regex, input);
+ }
+
+ public static void main(String[] args) {
+ String inputString = "Hello,123World,456Example";
+ String regex = "\\d+"; // \\d+ значит, что строка будет разбита стоящими в ней числами
+ splitString(inputString, regex);
+
+ String testString1 = "abcdefghijklmnopqrstuv18340";
+ String testString2 = "abcdefghijklmnoasdfasdpqrstuv18340";
+
+ System.out.println("Проверка строки: " + testString1 + " - "
+ + (isValidString(testString1) ? "Соответствует" : "Не соответствует"));
+ System.out.println("Проверка строки: " + testString2 + " - "
+ + (isValidString(testString2) ? "Соответствует" : "Не соответствует"));
+ }
+}
diff --git a/students/23K1302/pom.xml b/students/23K1302/pom.xml
index e7ace9dab..c30b6945b 100644
--- a/students/23K1302/pom.xml
+++ b/students/23K1302/pom.xml
@@ -27,5 +27,6 @@
23K1302-p11
23K1302-p12
23K1302-p13
+ 23K1302-p14
From 86ed591f46611a72beca77672c5bde947844b869 Mon Sep 17 00:00:00 2001
From: Timmmmofey <153191260+Timmmmofey@users.noreply.github.com>
Date: Tue, 29 Oct 2024 22:57:18 +0300
Subject: [PATCH 3/3] =?UTF-8?q?=D0=9B=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82?=
=?UTF-8?q?=D0=BE=D1=80=D0=BD=D0=B0=D1=8F=20=E2=84=9615?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
students/23K1302/23K1302-p15/pom.xml | 13 +++
.../java/ru/mirea/practice/s0000001/Main.java | 104 ++++++++++++++++++
students/23K1302/pom.xml | 1 +
3 files changed, 118 insertions(+)
create mode 100644 students/23K1302/23K1302-p15/pom.xml
create mode 100644 students/23K1302/23K1302-p15/src/main/java/ru/mirea/practice/s0000001/Main.java
diff --git a/students/23K1302/23K1302-p15/pom.xml b/students/23K1302/23K1302-p15/pom.xml
new file mode 100644
index 000000000..35ac04028
--- /dev/null
+++ b/students/23K1302/23K1302-p15/pom.xml
@@ -0,0 +1,13 @@
+
+
+ 4.0.0
+
+ 23K1302
+ ru.mirea.practice
+ 2024.1
+ ../pom.xml
+
+ 23K1302-p15
+ Задание 15
+
diff --git a/students/23K1302/23K1302-p15/src/main/java/ru/mirea/practice/s0000001/Main.java b/students/23K1302/23K1302-p15/src/main/java/ru/mirea/practice/s0000001/Main.java
new file mode 100644
index 000000000..2957a8444
--- /dev/null
+++ b/students/23K1302/23K1302-p15/src/main/java/ru/mirea/practice/s0000001/Main.java
@@ -0,0 +1,104 @@
+package ru.mirea.practice.s0000001;
+
+import java.awt.Button;
+import java.awt.Frame;
+import java.awt.TextField;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+
+public final class Main {
+
+ private Main() {
+
+ }
+
+ public static void main(String[] args) {
+ final Frame f = new Frame("Calculator Example");
+ final TextField tf1 = new TextField();
+ tf1.setBounds(50, 50, 150, 20);
+
+ final TextField tf2 = new TextField();
+ tf2.setBounds(50, 80, 150, 20);
+
+ final TextField tfResult = new TextField();
+ tfResult.setBounds(50, 140, 150, 20);
+ tfResult.setEditable(false);
+
+ Button addButton = new Button("+");
+ addButton.setBounds(50, 110, 50, 30);
+
+ Button subtractButton = new Button("-");
+ subtractButton.setBounds(110, 110, 50, 30);
+
+ Button multiplyButton = new Button("*");
+ multiplyButton.setBounds(170, 110, 50, 30);
+
+ Button divideButton = new Button("/");
+ divideButton.setBounds(230, 110, 50, 30);
+
+ addButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ try {
+ double num1 = Double.parseDouble(tf1.getText());
+ double num2 = Double.parseDouble(tf2.getText());
+ tfResult.setText(String.valueOf(num1 + num2));
+ } catch (NumberFormatException ex) {
+ tfResult.setText("Ошибка ввода");
+ }
+ }
+ });
+
+ subtractButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ try {
+ double num1 = Double.parseDouble(tf1.getText());
+ double num2 = Double.parseDouble(tf2.getText());
+ tfResult.setText(String.valueOf(num1 - num2));
+ } catch (NumberFormatException ex) {
+ tfResult.setText("Ошибка ввода");
+ }
+ }
+ });
+
+ multiplyButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ try {
+ double num1 = Double.parseDouble(tf1.getText());
+ double num2 = Double.parseDouble(tf2.getText());
+ tfResult.setText(String.valueOf(num1 * num2));
+ } catch (NumberFormatException ex) {
+ tfResult.setText("Ошибка ввода");
+ }
+ }
+ });
+
+ divideButton.addActionListener(new ActionListener() {
+ public void actionPerformed(ActionEvent e) {
+ try {
+ double num1 = Double.parseDouble(tf1.getText());
+ double num2 = Double.parseDouble(tf2.getText());
+ if (num2 != 0) {
+ tfResult.setText(String.valueOf(num1 / num2));
+ } else {
+ tfResult.setText("На ноль делить нельзя");
+ }
+ } catch (NumberFormatException ex) {
+ tfResult.setText("Ошибка ввода");
+ }
+ }
+ });
+
+ f.add(tf1);
+ f.add(tf2);
+ f.add(tfResult);
+ f.add(addButton);
+ f.add(subtractButton);
+ f.add(multiplyButton);
+ f.add(divideButton);
+
+ f.setSize(400, 300);
+ f.setLayout(null);
+ f.setVisible(true);
+ }
+}
diff --git a/students/23K1302/pom.xml b/students/23K1302/pom.xml
index c30b6945b..982c11523 100644
--- a/students/23K1302/pom.xml
+++ b/students/23K1302/pom.xml
@@ -28,5 +28,6 @@
23K1302-p12
23K1302-p13
23K1302-p14
+ 23K1302-p15