-
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.
Такие отдельные логические блоки, как этот (обработка окончаний), а также логические блоки с с вводом людей, вводом товаров и выводом результатов лучше выносить в отдельные сущности (методы и классы) и затем вызывать их там, где необходимо. Это позволяет улучшить читаемость кода, т.к. разнородная логика не смешивается в один сплошной код, а также упрощает поддержку кода.
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.
Лучше делать наименования более содержательными, эта тема хорошо раскрывается во 2 главе книги Роберта Мартина "Чистый код". Также на хабре есть краткий конспект книги: https://habr.com/ru/post/485118/
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.
pr = 0.0 - лишнее. В следующей строчке переприсваиваем
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.
Есть короткая конструкция sum += pr;
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.
Такие подряд идущие println можно объединить в один.
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.
Можно заменить на list.isEmpty
Консольное приложение