-
Notifications
You must be signed in to change notification settings - Fork 220
Comments
КОНСОЛЬНОЕ ПРИЛОЖЕНИЕ 1#75
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.
Для простого вывода строки можно не создавать отдельный метод
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.
Лучше использовать список из коллекций - например, ArrayList, потому что размер массива ограничен, а теоретически количество товаров неограниченное
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.
Есть принцип, который называется DRY - Don't repeat yourself. По этому правилу, если видишь, что есть многократно повторяющиеся участки кода, то их можно объединить. Здесь, например, изменяется лишь окончание, поэтому можно сделать строку, которая будет изменяться в зависимости от rounded, и затем присоединять её к предложению
AlekseyChist
commented
Oct 26, 2022
Простите я сильно болел гриппом, вот поправился, внес правки.
No description provided.