Skip to content

Проектная №1 - #1

Open
IsaevMilan wants to merge 3 commits into
mainfrom
dev
Open

IsaevMilan wants to merge 3 commits into
mainfrom
dev

Conversation

@IsaevMilan

Copy link
Copy Markdown
Owner

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

Comment thread src/main/java/Main.java
System.out.println("Количество людей не может быть меньше " + MIN_USER_COUNT);
}
}
final PricePlurals formatter = new PricePlurals();

Copy link
Copy Markdown

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
Copy Markdown

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
Copy Markdown

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants