Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Comments

попытка проверки#1

Open
reptylia3 wants to merge 3 commits intomain from
master
Open

попытка проверки #1
reptylia3 wants to merge 3 commits intomain from
master

Conversation

@reptylia3
Copy link
Owner

@reptylia3 reptylia3 commented Jun 23, 2024

No description provided.

Comment on lines +10 to +16
public String getName() {
return name;
}

public int getSpeed() {
return speed;
}
Copy link

@ArturNurtdinov ArturNurtdinov Jun 23, 2024

Choose a reason for hiding this comment

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

Так как два поля инициализируются в конструкторе и не меняются никогда, то можно не писать геттеры, а пометить два поля как public final - это будет безопасно

System.out.println("Введите скорость автомобиля " + name + " (от 1 до 250):");
try {
speed = scanner.nextInt();
if (speed > 0 && speed <= 250) {
Copy link

@ArturNurtdinov ArturNurtdinov Jun 23, 2024

Choose a reason for hiding this comment

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

максимальную и минимальную скорость лучше вынести в константы с говорящим названием

Comment on lines +5 to +11
public void checkNewLeader(Car car) {
int distance = car.getSpeed() * 24;
if (distance > leaderDistance) {
leaderDistance = distance;
leaderName = car.getName();
}
}
Copy link

@ArturNurtdinov ArturNurtdinov Jun 23, 2024

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

Reviewers

1 more reviewer

@ArturNurtdinov ArturNurtdinov ArturNurtdinov left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /