Skip to content
This repository was archived by the owner on Dec 28, 2024. It is now read-only.

Commit 56ec334

Browse files
committed
Add the pull from main branch
2 parents 84e1f55 + 44c31f5 commit 56ec334

File tree

2,766 files changed

+70731
-49
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,766 files changed

+70731
-49
lines changed

pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
<module>students/23K0145</module>
8181
<module>students/23K0186</module>
8282
<module>students/23K0755</module>
83+
<module>students/23K1292</module>
8384

8485
</modules>
8586
<dependencies>
@@ -147,7 +148,7 @@
147148
<dependency>
148149
<groupId>com.puppycrawl.tools</groupId>
149150
<artifactId>checkstyle</artifactId>
150-
<version>10.19.0</version>
151+
<version>10.20.1</version>
151152
</dependency>
152153
</dependencies>
153154
<configuration>

students/23F0011/23F0011-p11/pom.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<parent>
6+
<artifactId>23F0011</artifactId>
7+
<groupId>ru.mirea.practice</groupId>
8+
<version>2024.1</version>
9+
<relativePath>../pom.xml</relativePath>
10+
</parent>
11+
<artifactId>23F0011-p11</artifactId>
12+
<description>Массивы</description>
13+
</project>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package ru.mirea.practice.s23f0011;
2+
3+
import java.util.Date;
4+
5+
public abstract class Task1 {
6+
public static void main(String[] args) {
7+
// Фамилия разработчика
8+
String developerSurname = "Муртазин";
9+
10+
// Дата и время получения задания (указываем вручную)
11+
String assignmentReceived = "2024-11-01 10:00";
12+
13+
// Текущая дата и время сдачи задания
14+
Date submissionDate = new Date();
15+
16+
// Вывод информации
17+
System.out.println("Фамилия разработчика: " + developerSurname);
18+
System.out.println("Дата и время получения задания: " + assignmentReceived);
19+
System.out.println("Дата и время сдачи задания: " + submissionDate);
20+
}
21+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package ru.mirea.practice.s23f0011;
2+
3+
import java.util.Calendar;
4+
import java.util.GregorianCalendar;
5+
import java.util.Scanner;
6+
7+
public abstract class Task2 {
8+
public static void main(String[] args) {
9+
// Создаем объект Scanner для ввода данных от пользователя
10+
try (Scanner scanner = new Scanner(System.in)) {
11+
12+
// Получаем текущую дату
13+
Calendar currentDate = GregorianCalendar.getInstance();
14+
System.out.println("Текущая дата: " + currentDate.getTime());
15+
16+
// Запрашиваем у пользователя ввод даты
17+
System.out.print("Введите дату (формат: ГГГГ-ММ-ДД ЧЧ:ММ:СС): ");
18+
String userInput = scanner.nextLine();
19+
20+
// Разделяем введенную строку на составляющие
21+
String[] dateTimeParts = userInput.split(" ");
22+
String[] dateParts = dateTimeParts[0].split("-");
23+
String[] timeParts = dateTimeParts[1].split(":");
24+
25+
// Создаем объект Calendar для введенной даты
26+
Calendar userDate = new GregorianCalendar(
27+
Integer.parseInt(dateParts[0]), // Год
28+
Integer.parseInt(dateParts[1]) - 1, // Месяцы начинаются с 0
29+
Integer.parseInt(dateParts[2]),
30+
Integer.parseInt(timeParts[0]),
31+
Integer.parseInt(timeParts[1]),
32+
Integer.parseInt(timeParts[2])
33+
);
34+
35+
// Сравниваем даты
36+
if (userDate.before(currentDate)) {
37+
System.out.println("Введенная дата раньше текущей даты.");
38+
} else if (userDate.after(currentDate)) {
39+
System.out.println("Введенная дата позже текущей даты.");
40+
} else {
41+
System.out.println("Введенная дата совпадает с текущей датой.");
42+
}
43+
}
44+
45+
}
46+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package ru.mirea.practice.s23f0011.task3;
2+
3+
import java.text.SimpleDateFormat;
4+
import java.util.Date;
5+
6+
public class Student2 {
7+
private final String name;
8+
private final Date birthDate;
9+
10+
// Конструктор
11+
public Student2(String name, Date birthDate) {
12+
this.name = name;
13+
this.birthDate = birthDate;
14+
}
15+
16+
// Геттер для имени
17+
public String getName() {
18+
return name;
19+
}
20+
21+
// Геттер для даты рождения
22+
public Date getBirthDate() {
23+
return birthDate;
24+
}
25+
26+
// Метод для получения строкового представления даты рождения в заданном формате
27+
public String getFormattedBirthDate(String format) {
28+
SimpleDateFormat dateFormat = new SimpleDateFormat(format);
29+
return dateFormat.format(birthDate);
30+
}
31+
32+
// Переопределенный метод toString()
33+
@Override
34+
public String toString() {
35+
return "Student{"
36+
+ "name='" + name + '\''
37+
+ ", birthDate=" + getFormattedBirthDate("yyyy-MM-dd") // Стандартный формат
38+
+ '}';
39+
}
40+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package ru.mirea.practice.s23f0011.task3;
2+
3+
import java.util.Date;
4+
5+
public abstract class Tester {
6+
public static void main(String[] args) {
7+
// Пример использования класса Student
8+
Student2 student = new Student2("Иван Иванов", new Date());
9+
10+
// Вывод информации о студенте
11+
System.out.println(student);
12+
13+
// Вывод даты рождения в различных форматах
14+
System.out.println("Дата рождения (короткий формат): " + student.getFormattedBirthDate("dd.MM.yy"));
15+
System.out.println("Дата рождения (средний формат): " + student.getFormattedBirthDate("dd MMMM yyyy"));
16+
System.out.println("Дата рождения (полный формат): " + student.getFormattedBirthDate("EEEE, dd MMMM yyyy"));
17+
}
18+
}

students/23F0011/23F0011-p12/pom.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<parent>
6+
<artifactId>23F0011</artifactId>
7+
<groupId>ru.mirea.practice</groupId>
8+
<version>2024.1</version>
9+
<relativePath>../pom.xml</relativePath>
10+
</parent>
11+
<artifactId>23F0011-p12</artifactId>
12+
<description>Массивы</description>
13+
</project>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package ru.mirea.practice.s23f0011;
2+
3+
import java.awt.Color;
4+
import java.awt.Graphics;
5+
6+
class Circle extends Shape {
7+
private final int radius;
8+
9+
public Circle(Color color, int x, int y, int radius) {
10+
super(color, x, y);
11+
this.radius = radius;
12+
}
13+
14+
@Override
15+
public void draw(Graphics g) {
16+
g.setColor(color);
17+
g.fillOval(x - radius, y - radius, radius * 2, radius * 2);
18+
}
19+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package ru.mirea.practice.s23f0011;
2+
3+
import javax.swing.JPanel;
4+
import javax.swing.JFrame;
5+
import java.awt.Color;
6+
import java.awt.Graphics;
7+
import java.util.Random;
8+
9+
public class RandomShapes extends JPanel {
10+
private final Shape[] shapes;
11+
12+
public RandomShapes() {
13+
shapes = new Shape[20];
14+
Random random = new Random();
15+
16+
for (int i = 0; i < shapes.length; i++) {
17+
// Генерируем случайный цвет
18+
Color color = new Color(random.nextInt(256), random.nextInt(256), random.nextInt(256));
19+
// Генерируем случайные позиции
20+
int x = random.nextInt(400);
21+
int y = random.nextInt(400);
22+
// Генерируем случайный тип фигуры
23+
if (random.nextBoolean()) {
24+
// Создаем круг с радиусом от 10 до 50
25+
int radius = 10 + random.nextInt(41);
26+
shapes[i] = new Circle(color, x, y, radius);
27+
} else {
28+
// Создаем прямоугольник с шириной и высотой от 20 до 80
29+
int width = 20 + random.nextInt(61);
30+
int height = 20 + random.nextInt(61);
31+
shapes[i] = new RectangleShape(color, x, y, width, height);
32+
}
33+
}
34+
}
35+
36+
public static void main(String[] args) {
37+
JFrame frame = new JFrame("Случайные фигуры");
38+
RandomShapes panel = new RandomShapes();
39+
frame.add(panel);
40+
frame.setSize(500, 500);
41+
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
42+
frame.setVisible(true);
43+
}
44+
45+
@Override
46+
protected void paintComponent(Graphics g) {
47+
super.paintComponent(g);
48+
for (Shape shape : shapes) {
49+
shape.draw(g);
50+
}
51+
}
52+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package ru.mirea.practice.s23f0011;
2+
3+
import java.awt.Color;
4+
import java.awt.Graphics;
5+
6+
class RectangleShape extends Shape {
7+
private final int width;
8+
private final int height;
9+
10+
public RectangleShape(Color color, int x, int y, int width, int height) {
11+
super(color, x, y);
12+
this.width = width;
13+
this.height = height;
14+
}
15+
16+
@Override
17+
public void draw(Graphics g) {
18+
g.setColor(color);
19+
g.fillRect(x, y, width, height);
20+
}
21+
}

0 commit comments

Comments
 (0)