Repository navigation
Гонка "24 часа Ле-Мана" - #1
Open
sergeevNikita42 wants to merge 2 commits into
Open
sergeevNikita42 wants to merge 2 commits into
sergeevNikita42 wants to merge 2 commits into
Conversation
Comment on lines
+2
to
+3
| String name; | ||
| int speed; |
There was a problem hiding this comment.
Поля лучше пометить final, тем самым исключив возможность их модификации извне
| System.out.println("Введите скорость машины №" + carNumber + ":"); | ||
| try { | ||
| speed = Integer.parseInt(scanner.nextLine()); | ||
| if (speed > 0 && speed <= 250) { |
There was a problem hiding this comment.
Минимальную и максимальную скорости лучше вынести в константы для повышения читабельности кода
Comment on lines
+2
to
+3
| String fastestCarName; | ||
| int fastestSpeed; |
There was a problem hiding this comment.
Поля лучше пометить private, т.к. они относятся к внутренней логике работы этого класса, а для получения машины-победителя уже есть функция-геттер
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Добрый день!
Созданы классы:
class Car предназначен для создания объектов (машин).
class Race Race отвечает за определение самой быстрой машины.
class Main:
• Запрашивает и проверяет корректность ввода;
• Создает объекты Car и передает их в объект Race для определения самой быстрой машины;
• Выводит результат: название самой быстрой машины.