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

Open
sesmin-val wants to merge 4 commits intomain from
dev
Open

Практическая 1 #1
sesmin-val wants to merge 4 commits intomain from
dev

Conversation

@sesmin-val
Copy link
Owner

@sesmin-val sesmin-val commented Aug 4, 2025

No description provided.

Comment on lines +40 to +42
int speed;

String name;
Copy link

@ArturNurtdinov ArturNurtdinov Aug 4, 2025

Choose a reason for hiding this comment

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

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

}

class Race {
private ArrayList<Car> carsList;
Copy link

@ArturNurtdinov ArturNurtdinov Aug 4, 2025

Choose a reason for hiding this comment

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

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


if (scanner.hasNextInt()) {
speed = scanner.nextInt();
if (speed > 0 && speed < 250) {
Copy link

@ArturNurtdinov ArturNurtdinov Aug 4, 2025

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 によって変換されたページ (->オリジナル) /