-
Notifications
You must be signed in to change notification settings - Fork 0
Comments
Conversation
src/main/java/Main.java
Outdated
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.
⏫ Так как методы declension и price используются только в классе Calculator, их можно сделать private.
src/main/java/Main.java
Outdated
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.
Очень интересный алгоритм определения правильного окончания.
⚠ ️Немного сбивает с толку то, что все проверки находятся
внутри цикла. К сожалению, такой алгоритм не покрывает сценарий, когда sum равна 12, 13 или 14. В этих случаях мы всегда
будем получать "рубля".
Советую оставить в цилке только первую проверку
for(int i=11;i<=14;i++){ if((sum-i)%100==0){ 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.