-
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.
⏫ Так как функция priceEntry используется только внутри класса Calculator, мы можем сделать ее private
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.
⏫ Так как такая конкатенция строк будет создавать новый объект String каждый раз, можно воспользоваться более оптимизированным способом формирования строки - с помощью StringBuilder, и добавлять строку с помощью метода append
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.
⏫ Эти два условия можно было бы объединить под
if (valueOfPeople <= 0 || valueOfPeople > 20000) {...}
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.
⏫ Обычно функции, которые выполняют какое-либо действие принято называть глаголами. В твоем случае было бы удобнее назвать:
enterNumberOfPersons()enterProducts()
Проектная работа номер 1 на проверку.