Skip to content

Задача готова - #2

Open
FlByte wants to merge 1 commit into
mainfrom
practicum
Open

FlByte wants to merge 1 commit into
mainfrom
practicum

Conversation

@FlByte

@FlByte FlByte commented Apr 3, 2026

Copy link
Copy Markdown
Owner

No description provided.

Comment thread src/main/java/Main.java

int speed = 0;

while (true) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Не рекомендую писать бесконечные циклы через while (true) - лучше всегда явно прописывать условие выхода из цикла, чтобы уменьшить вероятность ошибиться и повысить читабельность кода

Comment thread src/main/java/Main.java
System.out.println("Введите скорость машины №" + i);
if (scanner.hasNextInt()) {
speed = scanner.nextInt();
if ((speed > 0) && (speed <= 250)) {

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 thread src/main/java/Race.java
Comment on lines +2 to +3
String name = "";
int distance = 0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Эти поля лучше сделать приватными, чтобы снаружи класса нельзя было сломать внутреннюю логику определения победителя

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