Repository navigation
Conversation
faritowich
reviewed
Jan 6, 2024
| break; | ||
| } | ||
|
|
||
| } |
There was a problem hiding this comment.
Такие отдельные логические блоки, как этот (ввод и обработка количества людей), а также логические блоки с вводом товаров и выводом результатов лучше выносить в отдельные методы и затем вызывать их там, где необходимо. Это позволяет улучшить читаемость кода, т.к. разнородная логика не смешивается в один сплошной код, а также упрощает поддержку кода.
| double sum; | ||
|
|
||
|
|
||
| public void tovarName(String tovar, double cost) { |
There was a problem hiding this comment.
Поплыло форматирование во всем файле. Есть хороший хоткей, можно нажать Alt + Ctrl + L и студия красиво отформатирует весь код на экране
| @@ -0,0 +1,50 @@ | |||
| public class Calculator { | |||
|
|
|||
| String tovar = ""; | |||
| public void check(int howMany) { | ||
|
|
||
| System.out.println("Все добавленные товары:"); | ||
| System.out.println(this.tovar); |
There was a problem hiding this comment.
Такие подряд идущие println можно объединить в один.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Мирошников, первое практическое задание