-
Notifications
You must be signed in to change notification settings - Fork 0
Comments
Conversation
ShKeril
commented
Nov 7, 2023
Не знаю можно ли предыдущие комиты удалить да и нужно ли
ShKeril
commented
Nov 7, 2023
- Обработка некорректных данных - честно говоря думал что функция NextInt() NextFloat() как бы подразумевают такую проверку иначе они мало чем отличаются от nextLine(). Ощущение что эти функции недоделаны
- По второму пункту сделал двойное деление по модулю вместо проверки диапазона. результат тот же но красивее
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.
🍏 В Java принято каждый класс располагать в отдельном файле
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.
🍏 Классно было бы подсказать пользователю, в каком формате от него ожидаются данные. Например, [название руб.коп]. А также предложить способ выхода из сценария
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.
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.
🍏 Немного поехало форматирование. Для форматирования кода и удаления неиспользуемых импортов применяй следующие сочетания клавиш:
Windows: Control+Alt+L
MacOS: Command+Option+L
Больше горячих клавиш можно найти здесь: https://developer.android.com/studio/intro/keyboard-shortcuts
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.
🍏 Рекомендую разделять большие методы на методы поменьше. Например, можно вынести этот цикл в отдельный метод
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.
🍏 Можно сохранять товары в список и производить объединение в строку для печати в самом конце. Это дает больше гибкости в использовании данных, полученных от пользователя. Также не будет создаваться множество промежуточных строк, если для формирования финальной строки использовать StringBuilder множественной конкатенации с помощью +.
https://habr.com/ru/articles/260767/
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.
🍏
src/main/java/Calculation.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.
🍏
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.
No description provided.