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

Проектная No1#1

Open
IsaevMilan wants to merge 3 commits intomain from
dev
Open

Проектная No1 #1
IsaevMilan wants to merge 3 commits intomain from
dev

Conversation

@IsaevMilan
Copy link
Owner

@IsaevMilan IsaevMilan commented Jan 10, 2023

Сдаю проектную работу!

System.out.println("Количество людей не может быть меньше " + MIN_USER_COUNT);
}
}
final PricePlurals formatter = new PricePlurals();
Copy link

@faritowich faritowich Jan 13, 2023

Choose a reason for hiding this comment

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

Можно сделать метод у класса PricePlurals тоже static, как и его поля, чтобы не пришлось создавать единственный экземпляр класса для однократного использования

private final int peopleCount;
private final PricePlurals formatter;

public Calculator(BufferedReader reader, int peopleCount, PricePlurals formatter) {
Copy link

@faritowich faritowich Jan 13, 2023

Choose a reason for hiding this comment

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

В конструктор лучше передавать то, чтобы необходимо снаружи класса передать внутрь класса для использования им. Если что-то можно и так создать внутри класса, то лучше так и сделать. Например, экземпляр BufferedReader можно создать внутри класса Calculator, PricePlurals сделать static

goodList.add(good);
totalPrice += price;
System.out.println("Товар успешно добален");
System.out.println("Напишите любой символ для добавления товара\n" + "или слово \"Завершить\" если хотите перейти к расчетам ");
Copy link

@faritowich faritowich Jan 13, 2023

Choose a reason for hiding this comment

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

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

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 によって変換されたページ (->オリジナル) /