-
Notifications
You must be signed in to change notification settings - Fork 0
Comments
Conversation
src/main/java/Calculator.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.
Поля лучше делать максимально ограниченными по видимости, в данном случае рекомендую сделать private
src/main/java/Calculator.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 или форматирование с помощью String.format
src/main/java/Calculator.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.
Эта строчка станет в разы понятнее, если divide переименовать в peopleCount, например
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.
В этой функции дополнительно нужно учесть, что для чисел, которые оканчиваются на 11-19 включительно, необходимо выводить слово "рублей"
src/main/java/Products.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.
Эти два поля могут быть константными:
Это исключит их изменение извне
MaxSatin
commented
Feb 16, 2024
Артур, привет!
Спасибо большое за правки, постарался все исправить как ты сказал.
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.
template лучше не писать, а сразу всё в одном вызове писать, иначе потом запутаешься с этой переменной сам
Домашняя работа. Приложение калькулятор.