-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
01db124
commit 441a969
Showing
44 changed files
with
1,085 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<artifactId>23K0130</artifactId> | ||
<groupId>ru.mirea.practice</groupId> | ||
<version>2024.1</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
<artifactId>23K0130-p11</artifactId> | ||
<description>11 задание</description> | ||
</project> |
12 changes: 12 additions & 0 deletions
12
students/23K0130/23K0130-p11/src/main/java/ru/mirea/practice/s23k0130/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package ru.mirea.practice.s23k0130; | ||
|
||
public final class Main { | ||
|
||
private Main() { | ||
|
||
} | ||
|
||
public static void main(String[] args) { | ||
System.out.println("11 практическая работа"); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
students/23K0130/23K0130-p11/src/main/java/ru/mirea/practice/s23k0130/task1/Developer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package ru.mirea.practice.s23k0130.task1; | ||
|
||
import java.util.Date; | ||
|
||
public abstract class Developer { | ||
public static void main(String[] args) { | ||
String developerLastName = "Еров"; | ||
String assignmentReceivedDate = "Fri Nov 01 10:00:00 MSK 2024"; | ||
Date currentDate = new Date(); | ||
System.out.println("Фамилия разработчика: " + developerLastName); | ||
System.out.println("Дата и время получения задания: " + assignmentReceivedDate); | ||
System.out.println("Дата и время сдачи задания: " + currentDate); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<artifactId>23K0130</artifactId> | ||
<groupId>ru.mirea.practice</groupId> | ||
<version>2024.1</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
<artifactId>23K0130-p12</artifactId> | ||
<description>12 задание</description> | ||
</project> |
12 changes: 12 additions & 0 deletions
12
students/23K0130/23K0130-p12/src/main/java/ru/mirea/practice/s23k0130/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package ru.mirea.practice.s23k0130; | ||
|
||
public final class Main { | ||
|
||
private Main() { | ||
|
||
} | ||
|
||
public static void main(String[] args) { | ||
System.out.println("12 практическая работа"); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
students/23K0130/23K0130-p12/src/main/java/ru/mirea/practice/s23k0130/task/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package ru.mirea.practice.s23k0130.task; | ||
|
||
public final class Main { | ||
|
||
private Main() { | ||
} | ||
|
||
public static void main(String[] args) { | ||
Square square = new Square(1.0, 2.0, "red"); | ||
Square triangle = new Square(1.0, 2.0, "blue"); | ||
System.out.println(square); | ||
System.out.println(triangle); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
students/23K0130/23K0130-p12/src/main/java/ru/mirea/practice/s23k0130/task/Shape.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package ru.mirea.practice.s23k0130.task; | ||
|
||
public abstract class Shape { | ||
|
||
private double x; | ||
private double y; | ||
private String color; | ||
|
||
public Shape(double x, double y, String color) { | ||
this.x = x; | ||
this.y = y; | ||
this.color = color; | ||
} | ||
|
||
public double getX() { | ||
return x; | ||
} | ||
|
||
public double getY() { | ||
return y; | ||
} | ||
|
||
public String getColor() { | ||
return color; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Shape{" | ||
+ "x='" + x + '\'' | ||
+ ", y='" + y + '\'' | ||
+ ", color='" + color + '\'' | ||
+ '}'; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
students/23K0130/23K0130-p12/src/main/java/ru/mirea/practice/s23k0130/task/Square.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package ru.mirea.practice.s23k0130.task; | ||
|
||
public class Square extends Shape { | ||
|
||
public Square(double x, double y, String color) { | ||
super(x, y, color); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Square{" + super.toString() + "}"; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
students/23K0130/23K0130-p12/src/main/java/ru/mirea/practice/s23k0130/task/Triangle.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package ru.mirea.practice.s23k0130.task; | ||
|
||
public class Triangle extends Shape { | ||
|
||
public Triangle(double x, double y, String color) { | ||
super(x, y, color); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Triangle{" + super.toString() + "}"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<artifactId>23K0130</artifactId> | ||
<groupId>ru.mirea.practice</groupId> | ||
<version>2024.1</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
<artifactId>23K0130-p13</artifactId> | ||
<description>13 задание</description> | ||
</project> |
12 changes: 12 additions & 0 deletions
12
students/23K0130/23K0130-p13/src/main/java/ru/mirea/practice/s23k0130/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package ru.mirea.practice.s23k0130; | ||
|
||
public final class Main { | ||
|
||
private Main() { | ||
|
||
} | ||
|
||
public static void main(String[] args) { | ||
System.out.println("13 практическая работа"); | ||
} | ||
} |
82 changes: 82 additions & 0 deletions
82
students/23K0130/23K0130-p13/src/main/java/ru/mirea/practice/s23k0130/task1/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package ru.mirea.practice.s23k0130.task1; | ||
|
||
import java.util.Locale; | ||
|
||
public final class Main { | ||
|
||
private Main() { | ||
|
||
} | ||
|
||
public static void main(String[] args) { | ||
String input = "I like Java!!!"; | ||
printLastCharacter(input); | ||
endsWithMarks(input); | ||
startsWithILike(input); | ||
containsJava(input); | ||
findSubstringPosition(input); | ||
System.out.println(replaceAWithO(input)); | ||
System.out.println(convertToUpperCase(input)); | ||
System.out.println(convertToLowerCase(input)); | ||
System.out.println(cutOutSubstring(input)); | ||
} | ||
|
||
public static void printLastCharacter(String str) { | ||
if (str != null && str.length() > 0) { | ||
char lastChar = str.charAt(str.length() - 1); | ||
System.out.println("Последний символ строки: " + lastChar); | ||
} else { | ||
System.out.println("Строка пуста или null."); | ||
} | ||
} | ||
|
||
public static void endsWithMarks(String str) { | ||
if (str.endsWith("!!!")) { | ||
System.out.println("Строка заканчивается на \"!!!\""); | ||
} else { | ||
System.out.println("Строка не заканчивается на \"!!!\""); | ||
} | ||
} | ||
|
||
public static void startsWithILike(String str) { | ||
if (str.startsWith("I like")) { | ||
System.out.println("Строка начинается с \"I like!\""); | ||
} else { | ||
System.out.println("Строка не начинается с \"I like!\""); | ||
} | ||
} | ||
|
||
public static void containsJava(String str) { | ||
if (str.contains("Java")) { | ||
System.out.println("Строка содержит \"Java\""); | ||
} else { | ||
System.out.println("Строка не содержит \"Java\""); | ||
} | ||
} | ||
|
||
public static void findSubstringPosition(String str) { | ||
if (str.indexOf("Java") != -1) { | ||
System.out.println("Подстрока \"Java\" найдена на позиции: " + str.indexOf("Java")); | ||
} else { | ||
System.out.println("Подстрока \"Java\" не найдена."); | ||
} | ||
} | ||
|
||
public static String replaceAWithO(String str) { | ||
return str.replace('a', 'o'); | ||
} | ||
|
||
public static String convertToUpperCase(String str) { | ||
return str.toUpperCase(Locale.US); | ||
} | ||
|
||
public static String convertToLowerCase(String str) { | ||
return str.toLowerCase(Locale.US); | ||
} | ||
|
||
public static String cutOutSubstring(String str) { | ||
int startIndex = str.indexOf("Java"); | ||
int endIndex = startIndex + "Java".length(); | ||
return str.substring(startIndex, endIndex); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
students/23K0130/23K0130-p13/src/main/java/ru/mirea/practice/s23k0130/task2/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package ru.mirea.practice.s23k0130.task2; | ||
|
||
public final class Main { | ||
private Main() { | ||
|
||
} | ||
|
||
public static void main(String[] args) { | ||
Person person1 = new Person("Еров", "Антон", "Владимирович"); | ||
Person person2 = new Person("Храмченков", null, "Владимирович"); | ||
Person person3 = new Person("Носов", "Данила", null); | ||
Person person4 = new Person("Васильев", null, null); | ||
|
||
System.out.println(person1.getFullName()); | ||
System.out.println(person2.getFullName()); | ||
System.out.println(person3.getFullName()); | ||
System.out.println(person4.getFullName()); | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
students/23K0130/23K0130-p13/src/main/java/ru/mirea/practice/s23k0130/task2/Person.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package ru.mirea.practice.s23k0130.task2; | ||
|
||
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 String getLastName() { | ||
return lastName; | ||
} | ||
|
||
public void setLastName(String lastName) { | ||
this.lastName = lastName; | ||
} | ||
|
||
public String getFirstName() { | ||
return firstName; | ||
} | ||
|
||
public void setFirstName(String firstName) { | ||
this.firstName = firstName; | ||
} | ||
|
||
public String getMiddleName() { | ||
return middleName; | ||
} | ||
|
||
public void setMiddleName(String middleName) { | ||
this.middleName = middleName; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<artifactId>23K0130</artifactId> | ||
<groupId>ru.mirea.practice</groupId> | ||
<version>2024.1</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
<artifactId>23K0130-p14</artifactId> | ||
<description>14 задание</description> | ||
</project> |
12 changes: 12 additions & 0 deletions
12
students/23K0130/23K0130-p14/src/main/java/ru/mirea/practice/s23k0130/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package ru.mirea.practice.s23k0130; | ||
|
||
public final class Main { | ||
|
||
private Main() { | ||
|
||
} | ||
|
||
public static void main(String[] args) { | ||
System.out.println("14 практическая работа"); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
students/23K0130/23K0130-p14/src/main/java/ru/mirea/practice/s23k0130/task2/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package ru.mirea.practice.s23k0130.task2; | ||
|
||
import java.util.regex.Pattern; | ||
import java.util.regex.Matcher; | ||
|
||
public final class Main { | ||
|
||
private Main() { | ||
|
||
} | ||
|
||
public static void main(String[] args) { | ||
String correctString = "abcdefghijklmnopqrstuv18340"; | ||
String incorrectString = "abcdefghijklmnoasdfasdpqrstuv18340"; | ||
|
||
String regex = "^abcdefghijklmnopqrstuv18340$"; | ||
Pattern pattern = Pattern.compile(regex); | ||
|
||
Matcher matcher1 = pattern.matcher(correctString); | ||
Matcher matcher2 = pattern.matcher(incorrectString); | ||
|
||
System.out.println(matcher1.matches()); | ||
System.out.println(matcher2.matches()); | ||
} | ||
} |
Oops, something went wrong.