Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Comments

Проект#1

Open
Shahidow wants to merge 2 commits intomain from
dev
Open

Проект #1
Shahidow wants to merge 2 commits intomain from
dev

Conversation

@Shahidow
Copy link
Owner

@Shahidow Shahidow commented Jun 4, 2023

No description provided.

return price;
}

public String declension(double sum) {
Copy link

@kirillNay kirillNay Jun 4, 2023

Choose a reason for hiding this comment

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

⏫ Так как методы declension и price используются только в классе Calculator, их можно сделать private.

public String declension(double sum) {
sum = Math.floor(sum);
for(int i=11; i<=14; i++) {
if((sum-i)%100 == 0) {
Copy link

@kirillNay kirillNay Jun 4, 2023

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" рублей.";
 }
}

А следом проверять остальные условия.

}
} No newline at end of file
}
class Calculator{
Copy link

@kirillNay kirillNay Jun 4, 2023

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

Reviewers

1 more reviewer

@kirillNay kirillNay kirillNay approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /