Skip to content

Hw1#1

Open
Jopick wants to merge 6 commits intomainfrom
hw1
Open

Hw1#1
Jopick wants to merge 6 commits intomainfrom
hw1

Conversation

@Jopick
Copy link
Copy Markdown
Owner

@Jopick Jopick commented Oct 17, 2023

No description provided.

Comment on lines +6 to +11
private String args;

public Task1(String args) {

this.args = args;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Зачем args передавать в конструктор, если все равно он потом приходит в функцию time(String args)?
Можно удалить это поле из класса, а конструктор сделать приватным

String minets = "";
String seconds = "";
int ch = 0;
String lol = "";
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не используется

Comment on lines +24 to +30
if (args.charAt(i) == ':') {
ch = 1;
} else if (ch == 0) {
minets += args.charAt(i);
} else {
seconds += args.charAt(i);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Можно попроще сделать args.split(":")
Но если хочешь так, то seconds и mitutes нужно собирать через StringBuilder

Comment on lines +4 to +9
private int args;

//public countDigits(int args) {
public Task2(int args) {
this.args = args;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

То же самое. Не очень понимаю логику передачи в конструктор переменной, которая потом также передается в функцию.

Comment on lines +15 to +16
answer += swap.charAt(i + 1);
answer += swap.charAt(i);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тоже StringBuilder нужен


public static final int INDEX_CHAR = 48;

public boolean proverochka(Integer x) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

proverochka можно сделать pivate, т.к. функция для внутреннего использования


public boolean isPalindromeDescendant(Integer palindrom) {
this.palindrom = palindrom;
String y = String.valueOf(palindrom);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Поработай над названием переменных. Тяжело читать код, приходится постоянно возвращаться наверх и вспоминать, что такое y, что lenn это не длина, а половина длины и т.д.

Comment on lines +31 to +33
x1 = massiv[MASSIV_SIZE - 1] * SIZE_10 * SIZE_10 * SIZE_10 + massiv[2] * SIZE_10 * SIZE_10 + massiv[1] * SIZE_10
+ massiv[0] - massiv[MASSIV_SIZE - 1] - massiv[2] * SIZE_10
- massiv[1] * SIZE_10 * SIZE_10 - massiv[0] * SIZE_10 * SIZE_10 * SIZE_10;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это сильно. Но лучше разбить на 3 операции:

  1. Получаем первое число
  2. Получаем второе число
  3. Находим разность
    Потому что мы понимаем, что тут происходит, пока помним условие задачи. Если коллега будет смотреть на этот код, ему придется долго разбираться зачем это все нужно.

Comment on lines +34 to +38
if (x1.equals(ANSWER)) {
return 0;
} else {
return (1 + swap(x1));
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Эта проверка есть в функции countK(). Почему бы ее здесь и не вызвать?

@adbeltyukov
Copy link
Copy Markdown

Привет, Иван! Нужно поправить замечания. Помимо замечаний, есть пара пунктов:

  1. На платформе edu надо сдать работу повторно, а не писать комментарий. Так я не смогу выставить баллы.
  2. project-template должен быть корнем твоего проекта, а не папкой в нем.
    Буду ждать исправлений :)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А почему не все файлы перенесены из project-template? Это тоже должно быть в корне проекта.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

И это

@adbeltyukov
Copy link
Copy Markdown

Привет! При переносе из project-template потерялись некоторые важные файлы. Сейчас зачту эту ДЗ, в следующем нужно будет добавить. 👍
Можно мержить в main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants