-
Notifications
You must be signed in to change notification settings - Fork 0
Финальный проект 1 спринта #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
src/main/java/Main.java
Outdated
| int numberOfPeople = 0; | ||
| while (numberOfPeople <= 1) { | ||
| System.out.println("На скольких человек поделить счет?"); | ||
| numberOfPeople = scanner.nextInt(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
src/main/java/Main.java
Outdated
| } | ||
| else { | ||
| System.out.println("Некорректное значение! Убедитесь, что вводите цифры в формате РУБЛИ,КОПЕЙКИ"); | ||
| continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🍏 continue здесь не влияет на работу цикла. Можно удалить
| 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 "рублей"; | ||
| } | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Работает корректно. Реализация простая и компактная 👍
No description provided.