-
Notifications
You must be signed in to change notification settings - Fork 0
Comments
Conversation
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.
От хранения массива машин и лишнего цикла при определении победителя можно избавиться, если при вводе данных сразу вычислять победителя и хранить его в отдельной переменной, тогда программа будет требовать меньше памяти и работать быстрее
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.
Число 24 лучше вынести в константу с говорящим названием для повышения читабельности кода
Uh oh!
There was an error while loading. Please reload this page.
Создано консольное приложение
Note
Implements a minimal console program to collect car data, validate input, and determine the fastest car.
Carmodel to storecarNameandcarSpeedWinnerclass withcalculateWinnerto pick the car with max distance over 24 hours (speed * 24)Mainreplaced to prompt for 3 cars, validate integer speeds within (0, 250], build a list, compute, and print the winner (winner.winnerStr)Written by Cursor Bugbot for commit c1e8623. This will update automatically on new commits. Configure here.