Skip to content

prefinish - #1

Open
Sistem-Pack wants to merge 1 commit into
mainfrom
dev
Open

Sistem-Pack wants to merge 1 commit into
mainfrom
dev

Conversation

@Sistem-Pack

Copy link
Copy Markdown
Owner

Надеюсь понял и сделал все правильно!

Comment thread src/main/java/Main.java
while (true) {
System.out.println("На сколько человек необходимо разделить счет?");
try {
peopleCount = Integer.parseInt(scan.next());

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 есть удобный метод hasNextInt, можно сразу узнать без дополнительных проверок возможно ли интерпретировать строку как int

Comment thread src/main/java/Main.java
while (true) {
System.out.println("Введите стоимость товара: ");
try {
price = Double.parseDouble(scan.next());

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 есть метод hasNextDouble
https://docs.oracle.com/javase/1.5.0/docs/api/java/util/Scanner.html#hasNextDouble%28%29

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