Skip to content

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

Open
FlByte wants to merge 1 commit intomainfrom
practicum
Open

Задача готова#2
FlByte wants to merge 1 commit intomainfrom
practicum

Conversation

@FlByte
Copy link
Copy Markdown
Owner

@FlByte FlByte commented Apr 3, 2026

No description provided.


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) - лучше всегда явно прописывать условие выхода из цикла, чтобы уменьшить вероятность ошибиться и повысить читабельность кода

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 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