Repository navigation
Калькулятора счёта - #1
Open
AlexandrFedoseev-1 wants to merge 4 commits into
Open
AlexandrFedoseev-1 wants to merge 4 commits into
AlexandrFedoseev-1 wants to merge 4 commits into
Conversation
…диалога с пользователем.
Charmandik
reviewed
Jan 10, 2024
Charmandik
left a comment
There was a problem hiding this comment.
Работа отличная, приятно читать и даже поправлять нечего)
| public class Formatter { | ||
| public String formatterRub(double price){ | ||
| double intPrice = Math.floor(price); | ||
| if (intPrice%10==1 && intPrice%100!=11){ |
There was a problem hiding this comment.
для ситуаций, когда условий больше 2, лучше использовать оператор switch-case
| double intPrice = Math.floor(price); | ||
| if (intPrice%10==1 && intPrice%100!=11){ | ||
| return "рубль"; | ||
| }else if (intPrice%10>=2 & intPrice%10<=4 & !(intPrice%100>=12 & intPrice%100<=14)){ |
There was a problem hiding this comment.
🍏Настоятельно рекомендую удалять неиспользуемый код, а также использовать комбинацию ctrl+alt+l (https://stackoverflow.com/questions/17879475/how-enable-auto-format-code-for-intellij-idea) для автоматического форматирования кода.
| System.out.println(String.format("Каждый человек должен заплатить: %.2f %s",calculator.splitCheck(), | ||
| formatter.formatterRub(calculator.splitCheck()))); | ||
| System.out.println("Чтобы посчитать новый чек введите любой символ, чтобы завершить введите \"Завершить\"" ); | ||
| if ("Завершить".equalsIgnoreCase(scanner.next().trim())) |
There was a problem hiding this comment.
попробуй разбить эту большую функцию на более маленькие с соответствующим им смысловым названием, так код станет гораздо легче воспринимать
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.