Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Comments

«Калькулятор счёта»#1

Open
PetrovaOla wants to merge 2 commits intomain from
dev
Open

«Калькулятор счёта» #1
PetrovaOla wants to merge 2 commits intomain from
dev

Conversation

@PetrovaOla
Copy link
Collaborator

@PetrovaOla PetrovaOla commented Aug 20, 2023

Консольное приложение No1
«Калькулятор счёта»

System.out.println("Список продуктов: ");
productList.forEach((s) -> System.out.println(s.name + " : " + s.price));
System.out.println("Итоговая сумма: " + parseRubCase(sum));
System.out.println("Итоговая сумма на каждого человека: " + parseRubCase(sum / count));
Copy link

@faritowich faritowich Aug 20, 2023

Choose a reason for hiding this comment

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

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

while (count < 2);
}

private static void addProductList(int count) {
Copy link

@faritowich faritowich Aug 20, 2023

Choose a reason for hiding this comment

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

Хорошо, что логика разнесена по разным методам, но лучше их была разнести и по разным классам, потому что у них совсем уж разные зоны ответственности

}
}

while (count < 2);
Copy link

@faritowich faritowich Aug 20, 2023

Choose a reason for hiding this comment

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

Этот логический блок также имело смысл вынести в отдельный метод, как это сейчас сделано с другими (ввод и обработка товаров, вывод окончания и тд)

do {
System.out.println("Введите цену товара в формате рубли.копейки");
String str = scanner.next();
if (str.trim().toUpperCase().toLowerCase().contains("завершить")) {
Copy link

@faritowich faritowich Aug 20, 2023

Choose a reason for hiding this comment

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

есть метод equalsIgnoreCase

active = false;
break;
}
if (!str.matches("[0-9]+\\.[0-9]+")) {
Copy link

@faritowich faritowich Aug 20, 2023

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

Reviewers

1 more reviewer

@faritowich faritowich faritowich left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /