Skip to content

Консольное приложение. Проектная работа №1. Проверка 1 - #1

Open
AlexOtkidach wants to merge 2 commits into
mainfrom
dev
Open

AlexOtkidach wants to merge 2 commits into
mainfrom
dev

Conversation

@AlexOtkidach

Copy link
Copy Markdown
Owner

No description provided.

Comment thread src/main/java/Main.java Outdated
//После добавления товара в калькулятор нужно показать пользователю сообщение об успешном добавлении товара.
System.out.println("Товар успешно добавлен!");
//После добавления товара нужно спрашивать у пользователя, хочет ли он добавить ещё один товар.
System.out.println("Может еще по одной;)");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Такие подряд идущие println лучше объединить в один

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Понял

Comment thread src/main/java/Calculator.java Outdated

list += p.productName + "\n";
}
public String getResult() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Поплыло форматирование, выглядит не очень читабельно. Есть хороший хоткей, можно нажать Alt + Ctrl + L и студия красиво отформатирует весь код на экране

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Круто, правда очень удобно)

Comment thread src/main/java/Main.java
if (sumGuests <= 0) {
System.out.println("Ой, кажется вы ошиблись;)! Введите от 2х человек и мы попробуем снова!");
}
System.out.println("Давайте попробуем снова: ");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Такие отдельные логические блоки, как этот (ввод и обработка количества людей), а также логические блоки с вводом товаров и выводом результатов лучше выносить в отдельные методы и затем вызывать их там, где необходимо. Это позволяет улучшить читаемость кода, т.к. разнородная логика не смешивается в один сплошной код, а также упрощает поддержку кода.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Понял, поправлю и буду обращать внимание.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants