Skip to content

Финальный проект 1 спринта - #1

Open
getastep wants to merge 3 commits into
mainfrom
dev
Open

getastep wants to merge 3 commits into
mainfrom
dev

Conversation

@getastep

@getastep getastep commented Feb 3, 2023

Copy link
Copy Markdown
Owner

No description provided.

Comment thread src/main/java/Main.java Outdated
int numberOfPeople = 0;
while (numberOfPeople <= 1) {
System.out.println("На скольких человек поделить счет?");
numberOfPeople = scanner.nextInt();

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 Outdated
}
else {
System.out.println("Некорректное значение! Убедитесь, что вводите цифры в формате РУБЛИ,КОПЕЙКИ");
continue;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🍏 continue здесь не влияет на работу цикла. Можно удалить

Comment thread src/main/java/Main.java
Comment on lines +77 to +95
String formatted(double number) {
int x = (int)number;
if (x % 100 / 10 == 1) {
return "рублей";
}
else {
switch (x % 10) {
case 1:
return "рубль";
case 2:
case 3:
case 4:
return "рубля";
default:
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.

Работает корректно. Реализация простая и компактная 👍

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