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

Проектная работа No1#1

Open
madj0ng wants to merge 4 commits intomain from
dev
Open

Проектная работа No1 #1
madj0ng wants to merge 4 commits intomain from
dev

Conversation

@madj0ng
Copy link
Owner

@madj0ng madj0ng commented Aug 28, 2023

Подсчет суммы оплаты для каждого человека с учетом остатка при делении.

calculator.outString(); // Вывод результатов
}
}
class Calculator{
Copy link

@AleksandrIlinskii AleksandrIlinskii Aug 29, 2023

Choose a reason for hiding this comment

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

Все классы нужно выносить в отдельный файл

Copy link
Owner Author

Choose a reason for hiding this comment

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

Для каждого класса свой файл?

return rubS;
}else{
return rubM;
}
Copy link

@AleksandrIlinskii AleksandrIlinskii Aug 29, 2023
edited
Loading

Choose a reason for hiding this comment

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

Твой код можно оптимизировать, и вместо if else if else использовать switch case
`String[] rubForms = {"Рубль", "Рублей", "Рубля"};
int mod = (int)(d % 100);
int res = (mod > 19) ? (mod % 10) : mod;

switch (res) {
case 1:
return rubForms[0];
case 2:
case 3:
case 4:
return rubForms[2];
default:
return rubForms[1];
}`

Copy link

@AleksandrIlinskii AleksandrIlinskii Aug 29, 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

@AleksandrIlinskii AleksandrIlinskii AleksandrIlinskii left review comments

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 によって変換されたページ (->オリジナル) /