Skip to content

Conversation

@IFeelLikeGod
Copy link
Owner

No description provided.

@github-actions
Copy link

github-actions bot commented Jan 6, 2026

Привет! 😉 Это твой первый Pull Request! Поздравляю тебя :)

public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = 3;

Choose a reason for hiding this comment

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

От этой переменной можно избавиться, если вынести значение в константу - private final static int CARS_AMOUNT = 3;

velocity = scanner.nextDouble();
scanner.nextLine();

if (velocity >= 0 && velocity <= 250) break;

Choose a reason for hiding this comment

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

Минимальную и максимальную скорости лучше вынести в константы для повышения читабельности кода

String name = scanner.nextLine();

double velocity;
while (true) {

Choose a reason for hiding this comment

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

Код для считывания скорости с ввода лучше вынести в отдельную функцию - код, разделённый на небольшие функции, легче читать, поддерживать и переиспользовать

}
}

class Car {

Choose a reason for hiding this comment

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

Код классов лучше выносить в отдельные файлы, чтобы не хранить весь код в одном файле

Comment on lines +42 to +43
String name;
double velocity;

Choose a reason for hiding this comment

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

Поля лучше пометить final, тем самым исключив возможность их модификации извне

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.

3 participants