Skip to content

Гонка Ле-Мана-Это мой первый pull request для практической работы - #1

Open
ZarinaLebedeva wants to merge 1 commit into
mainfrom
dev
Open

ZarinaLebedeva wants to merge 1 commit into
mainfrom
dev

Conversation

@ZarinaLebedeva

Copy link
Copy Markdown
Owner

Я создала этот pull request для прохождения своей первой проверки практической работы "Гонка 24 часа Ле-мана".

Comment thread src/main/java/Car.java
Comment on lines +2 to +4
public String name;
public int 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.

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

Comment thread src/main/java/Main.java
System.out.println("Введите скорость машины № " + i + ":");
if (scanner.hasNextInt()) {
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 +2 to +3
String nameOfLeader = "";
int currentLeaderDistance = 0;

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