Skip to content

Проектная работа №1 - #1

Open
KlayBot wants to merge 1 commit into
devfrom
24_LaMana
Open

KlayBot wants to merge 1 commit into
devfrom
24_LaMana

Conversation

@KlayBot

@KlayBot KlayBot commented Jun 9, 2025

Copy link
Copy Markdown
Owner

No description provided.

@KlayBot KlayBot closed this Jun 9, 2025
@KlayBot KlayBot reopened this Jun 9, 2025
Comment thread src/main/java/Car.java
Comment on lines +2 to +3
private final String name;
private final int spead;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Поля можно сделать публичными и удалить функции-геттеры. Т.к. ты пометил поля final, то можно оставить прямой доступ до полей - это будет так же надёжно, как и с геттерами

Comment thread src/main/java/Main.java
spead = scanner.nextInt();
scanner.nextLine();

if (spead > 0 && spead <= 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
private int maxDistance = 0;

public void updateLeader(Car car) {
int distance = (24) * car.getSpeed();

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