-
Notifications
You must be signed in to change notification settings - Fork 0
Comments
Conversation
@ArturNurtdinov
ArturNurtdinov
left a comment
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/Car.java
Outdated
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.
Поля лучше пометить final, тем самым исключив возможность их модификации извне
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.
смогла пометить name как final, но speed инициализируется в мейне, иначе бы пришлось метод в этом классе объявлять для инициализации
src/main/java/Car.java
Outdated
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.
Пустой конструктор можно удалить, т.к. смысла в объекте, у которого name = null, а speed = 0, - мало
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
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.
я ввела константы, общую переменную для победителя и для сохранения максимальной дистанции.
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
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.
Минимальную и максимальную скорости лучше вынести в константы для повышения читабельности кода
Создала консольное приложение