-
Notifications
You must be signed in to change notification settings - Fork 0
First review #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
First review #1
Conversation
src/main/java/Car.java
Outdated
| return speed; | ||
| } | ||
|
|
||
| public void setName(String name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Сеттеры по идее здесь лишние, так как поля передаются при создании объекта в конструкторе
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Исправил
src/main/java/Main.java
Outdated
| name = scanner.next(); | ||
| while (true) { | ||
| System.out.println("— Введите скорость машины №" + i +":"); | ||
| speed = scanner.nextInt(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Здесь при вводе нецелочисленных значений будет креш, который нигде не обрабатывается. Необходимо добавить обработку и попросить пользователя ввести данные заново
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Исправил
| private Car leader; | ||
| private Integer time = 24; | ||
|
|
||
| private Map<Car, Integer> participantsResults; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Можно обойтись без хранения всех машин в мапе, если сразу при вводе данных определять победителя, таким образом программа будет работать быстрее и требовать меньше памяти
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ну мы не знаем как это приложение будет жить дальше. Может потом надо будет выводить список всех машин или первое второе и третье место. (имеется в виду условно). Поэтому я выбрал конструкцию с заделом на расширение
No description provided.