Skip to content

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

Open
reptylia3 wants to merge 3 commits into
mainfrom
master
Open

reptylia3 wants to merge 3 commits into
mainfrom
master

Conversation

@reptylia3

Copy link
Copy Markdown
Owner

No description provided.

Comment thread src/main/java/Car.java
Comment on lines +10 to +16
public String getName() {
return name;
}

public int getSpeed() {
return speed;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

Comment thread src/main/java/Main.java
System.out.println("Введите скорость автомобиля " + name + " (от 1 до 250):");
try {
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 thread src/main/java/Race.java
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
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