Skip to content

Первая практическая работа - #1

Open
DFater wants to merge 3 commits into
mainfrom
master
Open

DFater wants to merge 3 commits into
mainfrom
master

Conversation

@DFater

@DFater DFater commented Nov 27, 2022

Copy link
Copy Markdown
Owner

Надеюсь я правильно сделал Pull Request. Но программа вроде работает :)

System.out.println("Товар успешно добавлен! ");
}
while (price <= 0) {
if (price <= 0) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Из-за строчки выше всегда будет true, можно убрать

} else if (modularDivision == 2 || modularDivision == 3 || modularDivision == 4) {
return "рубля";
}
return "рублей";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Не учтена ситуация для чисел 11-19, окончание должно быть "рублей", а сейчас дает рубля для 12-14. Для этого стоит проверять, что i % 100 между 11 и 19 включительно находится

double modularDivision = i % 10;
if (modularDivision == 1) {
return "рубль";
} else if (modularDivision == 2 || modularDivision == 3 || modularDivision == 4) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Можно упростить modularDivision >= 2 && modularDivision <= 4

Comment thread src/main/java/Main.java
System.out.println("Введенно не корректное количество людей! Попробуйте занво:");
numberOfPeople = scanner.nextInt();
}
if (numberOfPeople == 1) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Можно поставить просто else

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