Skip to content

splitting the account - #25

Closed
Artemo4ka wants to merge 4 commits into
Yandex-Practicum:devfrom
Artemo4ka:dev
Closed

Artemo4ka wants to merge 4 commits into
Yandex-Practicum:devfrom
Artemo4ka:dev

Conversation

@Artemo4ka

Copy link
Copy Markdown

No description provided.

artem added 2 commits January 26, 2023 00:17
@Artemo4ka
Artemo4ka changed the base branch from dev to main January 29, 2023 03:19
@Artemo4ka
Artemo4ka changed the base branch from main to dev January 29, 2023 03:20
Comment thread src/main/java/Main.java
finish();

}
public static class CountPersons {

Copy link
Copy Markdown

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
System.out.println("Сколько вас человек?");
while (true) {
if (scanner.hasNextDouble()) {
persons = scanner.nextInt();

@gusar-off gusar-off Jan 29, 2023 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Получается ты проверяешь есть ли в пользовательском инпуте double, а парсишь его как int, это вызовет исключение java.util.InputMismatchException. В данном случае нужно использовать метод hasNextInt

Comment thread src/main/java/Main.java
}
}
public static void addProduct() {
Scanner scanner = new Scanner(System.in);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Лучшее переиспользовать инстанс Scanner, а не создавать каждый раз новый.

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.

3 participants