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

Консольное приложение No1#1

Open
ValentinPside wants to merge 9 commits intodev from
main
Open

Консольное приложение No1 #1
ValentinPside wants to merge 9 commits intodev from
main

Conversation

@ValentinPside
Copy link
Owner

@ValentinPside ValentinPside commented Dec 27, 2022

Вопрос ао ПР: при пуше изменения идут в ветку main, а не в dev. Как это исправить?

System.out.println("Счёт будет разделён на " + personCount + " персоны");
return personCount;
}
}
Copy link

@gusar-off gusar-off Dec 28, 2022

Choose a reason for hiding this comment

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

У Scanner есть удобный метод hasNextInt, можно сразу узнать без дополнительных проверок возможно ли интерпретировать строку как int

if(!line.equals(line.replaceAll("[^0-9.]", ""))){
System.out.println("Нужно число без букв. Попробуйте снова");
continue;
}
Copy link

@gusar-off gusar-off Dec 28, 2022

Choose a reason for hiding this comment

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

}
if(ending.equals("5") || ending.equals("6") || ending.equals("7") || ending.equals("8") || ending.equals("9") ||ending.equals("0")){
ending = z;
}
Copy link

@gusar-off gusar-off Dec 28, 2022

Choose a reason for hiding this comment

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

Эти проверки дублируются тут и в totalPriceForPerson

}
if(ending.equals("5") || ending.equals("6") || ending.equals("7") || ending.equals("8") || ending.equals("9") ||ending.equals("0")){
ending = z;
}
Copy link

@gusar-off gusar-off Dec 28, 2022

Choose a reason for hiding this comment

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

⚠️Немного некорректно рассчитывается окончание. Получается если цена будет 14 рублей, метод вернет рубля. Правильный алгоритм звучит так - Проверить лежит ли остаток от деления на 100 в интервале от 11 до 14 включительно, если да, то возвращаем рублей, если нет, то берем остаток от деления на 10 и поверяем, если 1 - рубль, 2-3-4 то рубля, в противном случае - рублей. То есть нужно во-первых проверять именно остаток от деления, во-вторых учесть, что числа заканчивающиеся на 11-12-13-14 и заканчивающиеся на 1-2-3-4, будут иметь разные окончания

ending = x;
}
if(ending.equals("2") || ending.equals("3") || ending.equals("4")){
ending = x;
Copy link

@gusar-off gusar-off Dec 28, 2022

Choose a reason for hiding this comment

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

Тут опечатался, должно быть y

Copy link

Вопрос ао ПР: при пуше изменения идут в ветку main, а не в dev. Как это исправить?

Это значит, что ты находишься в ветке main, чтобы сменить ветку у консольного приложения git есть команда checkout
git checkout dev сменит твою текущую ветку и позволит пушить в дев.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer

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